You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
due to e.Viper.ReadInConfig() that is invoked as part of Enviper#Unmarshal any additional fields added via Viper#MergeConfigMap method are cleared. That prevents usage like that:
e := enviper.New(viper.New())
if err := e.ReadInConfig(); err != nil {
panic(err.Error())
}
if err := e.MergeConfigMap(defaults.AllSettings()); err != nil {
panic(err.Error())
}
if err := e.Unmarshal(&cfg); err != nil {
panic(err.Error())
}
Is there a reason why Unmarshal makes a call to ReadInConfig? Afaik, viper itself expects users to call ReadInConfig explicitly before Unmarshal is used
The text was updated successfully, but these errors were encountered:
This was in original solution. I actually don't remember why is this required. You could fork this repo, drop that line and run tests and see if it will work for you
Hi,
due to
e.Viper.ReadInConfig()
that is invoked as part ofEnviper#Unmarshal
any additional fields added viaViper#MergeConfigMap
method are cleared. That prevents usage like that:Is there a reason why
Unmarshal
makes a call toReadInConfig
? Afaik, viper itself expects users to callReadInConfig
explicitly beforeUnmarshal
is usedThe text was updated successfully, but these errors were encountered: