mirror of https://github.com/spf13/viper.git
Marshal now gets the map via the AllSettings method
This commit is contained in:
parent
82cbb7dec7
commit
347c770cfb
15
viper.go
15
viper.go
|
@ -313,23 +313,10 @@ func (v *viper) MarshalKey(key string, rawVal interface{}) error {
|
|||
// Marshals the config into a Struct
|
||||
func Marshal(rawVal interface{}) error { return v.Marshal(rawVal) }
|
||||
func (v *viper) Marshal(rawVal interface{}) error {
|
||||
err := mapstructure.Decode(v.defaults, rawVal)
|
||||
err := mapstructure.WeakDecode(v.AllSettings(), rawVal)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = mapstructure.Decode(v.config, rawVal)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = mapstructure.Decode(v.override, rawVal)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = mapstructure.Decode(v.kvstore, rawVal)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v.insensativiseMaps()
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue