mirror of
https://github.com/distribution/distribution
synced 2024-11-06 19:35:52 +01:00
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
@ -166,6 +166,17 @@ func (p *Parser) overwriteFields(v reflect.Value, fullpath string, path []string
|
||||
return p.overwriteStruct(v, fullpath, path, payload)
|
||||
case reflect.Map:
|
||||
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:
|
||||
if v.NumMethod() == 0 {
|
||||
if !v.IsNil() {
|
||||
|
Loading…
Reference in New Issue
Block a user