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:
@@ -24,7 +24,7 @@ type yamlSourceContext struct {
|
||||
// NewYamlSourceFromFile creates a new Yaml InputSourceContext from a filepath.
|
||||
func NewYamlSourceFromFile(file string) (InputSourceContext, error) {
|
||||
ysc := &yamlSourceContext{FilePath: file}
|
||||
var results map[string]interface{}
|
||||
var results map[interface{}]interface{}
|
||||
err := readCommandYaml(ysc.FilePath, &results)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to load Yaml file '%s': inner error: \n'%v'", ysc.FilePath, err.Error())
|
||||
|
Reference in New Issue
Block a user