mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-23 08:32:30 +00:00
feat: unified config (#533)
* chore: add yaml config ref * feat: add initial implementation of a traefik like cli * refactor: remove dependency on traefik * chore: update example env * refactor: update build * chore: remove unused code * fix: fix translations not loading * feat: add experimental config file support * chore: mod tidy * fix: review comments * refactor: move tinyauth to separate package * chore: add quotes to all env variables * chore: resolve go mod and sum conflicts * chore: go mod tidy * fix: review comments
This commit is contained in:
@@ -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, root string) (T, error) {
|
||||
var labelsDecoded T
|
||||
|
||||
err := parser.Decode(labels, &appLabels, "tinyauth", "tinyauth.apps")
|
||||
err := parser.Decode(labels, &labelsDecoded, "tinyauth", "tinyauth."+root)
|
||||
|
||||
if err != nil {
|
||||
return config.Apps{}, err
|
||||
return labelsDecoded, err
|
||||
}
|
||||
|
||||
return appLabels, nil
|
||||
return labelsDecoded, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user