switch glauth to struct tag based env config

This commit is contained in:
Willy Kloucek
2022-01-07 15:39:01 +00:00
committed by Jörn Friedrich Dreyer
parent 161dd949fc
commit 788a390016
16 changed files with 120 additions and 247 deletions
+2 -2
View File
@@ -86,12 +86,12 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
// load all env variables relevant to the config in the current context.
envCfg := config.Config{}
if err := envdecode.Decode(&envCfg); err != nil {
if err := envdecode.Decode(&envCfg); err != nil && err.Error() != "none of the target fields were set from environment variables" {
return err
}
// merge environment variable config on top of the current config
if err := mergo.Merge(cfg, envCfg, mergo.WithOverride); err != nil && err.Error() != "none of the target fields were set from environment variables" {
if err := mergo.Merge(cfg, envCfg, mergo.WithOverride); err != nil {
return err
}