preserve default value if not set in config file

This commit is contained in:
Steeve Chailloux 2015-07-04 02:28:58 -05:00
parent 12990ac1c8
commit 31f218ede6

View file

@ -681,7 +681,9 @@ 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:])
v.config[key] = val
if val != nil {
v.config[key] = val
}
}
}
v.aliases[alias] = key