diff --git a/service/config.go b/service/config.go index 7662e9e..7c23ca1 100644 --- a/service/config.go +++ b/service/config.go @@ -34,7 +34,13 @@ func SetConfigDefaults() { } func LoadConfig() { - viper.UnmarshalKey("Service", &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("Service", &C) + C.DNS.Server = viper.GetString("Service.DNS.Server") + C.DNS.DefaultTTL = viper.GetUint32("Service.DNS.DefaultTTL") + C.Users.ConfigDir = viper.GetString("Service.Users.ConfigDir") } func (obj *config) PrettyPrint() string { diff --git a/webapi/config.go b/webapi/config.go index f5d5871..93cd1a8 100644 --- a/webapi/config.go +++ b/webapi/config.go @@ -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 {