Added support for configuring array values with environment variables #3511
Signed-off-by: Andrii Soldatenko <andrii.soldatenko@dynatrace.com>
This commit is contained in:
parent
003dd5aaa1
commit
916b94eb3a
1 changed files with 11 additions and 0 deletions
|
@ -166,6 +166,17 @@ func (p *Parser) overwriteFields(v reflect.Value, fullpath string, path []string
|
||||||
return p.overwriteStruct(v, fullpath, path, payload)
|
return p.overwriteStruct(v, fullpath, path, payload)
|
||||||
case reflect.Map:
|
case reflect.Map:
|
||||||
return p.overwriteMap(v, fullpath, path, payload)
|
return p.overwriteMap(v, fullpath, path, payload)
|
||||||
|
case reflect.Slice:
|
||||||
|
idx, err := strconv.Atoi(path[0])
|
||||||
|
if err != nil {
|
||||||
|
panic("non-numeric index: " + path[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
if idx >= v.Len() {
|
||||||
|
panic("Undefined index: " + path[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.overwriteFields(v.Index(idx), fullpath, path[1:], payload)
|
||||||
case reflect.Interface:
|
case reflect.Interface:
|
||||||
if v.NumMethod() == 0 {
|
if v.NumMethod() == 0 {
|
||||||
if !v.IsNil() {
|
if !v.IsNil() {
|
||||||
|
|
Loading…
Reference in a new issue