This commit is contained in:
Stavros
2025-11-04 17:37:40 +02:00
parent 5f7e89c330
commit 1ad862d86c
13 changed files with 155 additions and 230 deletions

View File

@@ -1,19 +1,17 @@
package decoders
import (
"tinyauth/internal/config"
"github.com/traefik/paerser/parser"
)
func DecodeLabels(labels map[string]string) (config.Apps, error) {
var appLabels config.Apps
func DecodeLabels[T any](labels map[string]string) (T, error) {
var target T
err := parser.Decode(labels, &appLabels, "tinyauth", "tinyauth.apps")
err := parser.Decode(labels, &target, "tinyauth")
if err != nil {
return config.Apps{}, err
return target, err
}
return appLabels, nil
return target, nil
}