switch glauth to struct tag based env config
This commit is contained in:
committed by
Jörn Friedrich Dreyer
parent
161dd949fc
commit
788a390016
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user