mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-02-26 02:41:59 +00:00
refactor: mode label decoder to separate package
This commit is contained in:
19
internal/utils/decoders/label_decoder.go
Normal file
19
internal/utils/decoders/label_decoder.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package decoders
|
||||
|
||||
import (
|
||||
"tinyauth/internal/config"
|
||||
|
||||
"github.com/traefik/paerser/parser"
|
||||
)
|
||||
|
||||
func DecodeLabels(labels map[string]string) (config.Apps, error) {
|
||||
var appLabels config.Apps
|
||||
|
||||
err := parser.Decode(labels, &appLabels, "tinyauth", "tinyauth.apps")
|
||||
|
||||
if err != nil {
|
||||
return config.Apps{}, err
|
||||
}
|
||||
|
||||
return appLabels, nil
|
||||
}
|
||||
Reference in New Issue
Block a user