mirror of
https://github.com/spf13/viper
synced 2025-05-06 12:17:18 +00:00
Fix UnmarshalKey to use of defaultDecoderConfig
This commit is contained in:
parent
237b7040d9
commit
5168378d82
1 changed files with 9 additions and 1 deletions
10
viper.go
10
viper.go
|
@ -713,7 +713,15 @@ func (v *Viper) GetSizeInBytes(key string) uint {
|
||||||
// UnmarshalKey takes a single key and unmarshals it into a Struct.
|
// UnmarshalKey takes a single key and unmarshals it into a Struct.
|
||||||
func UnmarshalKey(key string, rawVal interface{}) error { return v.UnmarshalKey(key, rawVal) }
|
func UnmarshalKey(key string, rawVal interface{}) error { return v.UnmarshalKey(key, rawVal) }
|
||||||
func (v *Viper) UnmarshalKey(key string, rawVal interface{}) error {
|
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
|
// Unmarshal unmarshals the config into a Struct. Make sure that the tags
|
||||||
|
|
Loading…
Add table
Reference in a new issue