mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Marshal now gets the map via the AllSettings method
Conflicts: viper.go
This commit is contained in:
parent
700eefa74b
commit
2e2f3b2643
1 changed files with 2 additions and 13 deletions
15
viper.go
15
viper.go
|
@ -350,19 +350,8 @@ func (v *Viper) MarshalKey(key string, rawVal interface{}) error {
|
||||||
// Marshals the config into a Struct
|
// Marshals the config into a Struct
|
||||||
func Marshal(rawVal interface{}) error { return v.Marshal(rawVal) }
|
func Marshal(rawVal interface{}) error { return v.Marshal(rawVal) }
|
||||||
func (v *Viper) Marshal(rawVal interface{}) error {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue