altsrc: allow nested defaults in yaml files

Previously, defaults specified as nested keys in a yaml file would not
be recognized, i.e. `top: \n  bottom: key` would not be accessible using
the name `top.bottom`, but `top.bottom: key` would. These changes
support using nested keys by traversing the configuration tree if the
key name uses '.' as a delimiter.
This commit is contained in:
rob boll
2016-04-29 12:33:59 -04:00
parent 9fec0fad02
commit 36a5323a47
4 changed files with 232 additions and 4 deletions

View File

@@ -296,7 +296,7 @@ func TestFloat64ApplyInputSourceMethodEnvVarSet(t *testing.T) {
}
func runTest(t *testing.T, test testApplyInputSource) *cli.Context {
inputSource := &MapInputSource{valueMap: map[string]interface{}{test.FlagName: test.MapValue}}
inputSource := &MapInputSource{valueMap: map[interface{}]interface{}{test.FlagName: test.MapValue}}
set := flag.NewFlagSet(test.FlagSetName, flag.ContinueOnError)
c := cli.NewContext(nil, set, nil)
if test.EnvVarName != "" && test.EnvVarValue != "" {