Fix: viper.UnmarshalKey ignores defaults

This seems to be a bug in viper, as soon as we're working with subkeys, things fall apart
This commit is contained in:
2021-08-24 17:03:59 +02:00
parent 467a89c4ba
commit a6e52d9d3d
2 changed files with 12 additions and 2 deletions

View File

@ -22,7 +22,11 @@ func SetConfigDefaults() {
}
func LoadConfig() {
viper.UnmarshalKey("WebAPI", &C)
// Does not work with partially overrides, only GetXXX does resolve the subkeys correctly
// https://github.com/spf13/viper/issues/798
// https://github.com/spf13/viper/issues/309
// viper.UnmarshalKey("WebAPI", &C)
C.ListenAddress = viper.GetString("WebAPI.ListenAddress")
}
func (obj *config) PrettyPrint() string {