Fix UnmarshalKey to use of defaultDecoderConfig

This commit is contained in:
Miguel Eduardo Gil Biraud 2017-01-21 01:53:06 +01:00
parent 237b7040d9
commit 5168378d82

View file

@ -713,7 +713,15 @@ func (v *Viper) GetSizeInBytes(key string) uint {
// UnmarshalKey takes a single key and unmarshals it into a Struct.
func UnmarshalKey(key string, rawVal interface{}) error { return v.UnmarshalKey(key, rawVal) }
func (v *Viper) UnmarshalKey(key string, rawVal interface{}) error {
return mapstructure.Decode(v.Get(key), rawVal)
err := decode(v.Get(key), defaultDecoderConfig(rawVal))
if err != nil {
return err
}
v.insensitiviseMaps()
return nil
}
// Unmarshal unmarshals the config into a Struct. Make sure that the tags