mirror of https://github.com/spf13/viper.git
preserve default value if not set in config file
This commit is contained in:
parent
12990ac1c8
commit
31f218ede6
2
viper.go
2
viper.go
|
@ -681,9 +681,11 @@ func (v *Viper) registerAlias(alias string, key string) {
|
|||
source := v.find(path[0])
|
||||
if source != nil && reflect.TypeOf(source).Kind() == reflect.Map {
|
||||
val := v.searchMap(cast.ToStringMap(source), path[1:])
|
||||
if val != nil {
|
||||
v.config[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
v.aliases[alias] = key
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue