config: Fix merge of config with map[string]string values.

Fixes #8679
This commit is contained in:
Bjørn Erik Pedersen
2021-06-22 09:53:37 +02:00
parent 9312059888
commit 4a9d408fe0
9 changed files with 133 additions and 17 deletions

View File

@@ -226,7 +226,7 @@ func toMergeStrategy(v interface{}) ParamsMergeStrategy {
// PrepareParams
// * makes all the keys in the given map lower cased and will do so
// * This will modify the map given.
// * Any nested map[interface{}]interface{} will be converted to Params.
// * Any nested map[interface{}]interface{}, map[string]interface{},map[string]string will be converted to Params.
// * Any _merge value will be converted to proper type and value.
func PrepareParams(m Params) {
for k, v := range m {
@@ -236,7 +236,7 @@ func PrepareParams(m Params) {
v = toMergeStrategy(v)
retyped = true
} else {
switch v.(type) {
switch vv := v.(type) {
case map[interface{}]interface{}:
var p Params = cast.ToStringMap(v)
v = p
@@ -247,6 +247,14 @@ func PrepareParams(m Params) {
v = p
PrepareParams(p)
retyped = true
case map[string]string:
p := make(Params)
for k, v := range vv {
p[k] = v
}
v = p
PrepareParams(p)
retyped = true
}
}