fixes unmarshalKey doesn't work with time.Duration

This commit is contained in:
Diep Pham 2017-04-10 15:56:10 +07:00
parent 0dd8eb23d0
commit 1af7e37071

View file

@ -719,7 +719,7 @@ 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)
return decode(v.Get(key), defaultDecoderConfig(rawVal))
}
// Unmarshal unmarshals the config into a Struct. Make sure that the tags