Skip to content

Commit

Permalink
fix: configuration_parser surrogate_key headers
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweak committed Dec 20, 2022
1 parent 17418db commit fd86a57
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions plugins/souin/agnostic/configuration_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ func parseCacheKeys(ccConfiguration map[string]interface{}) map[configurationtyp
case "hide":
ck.Hide = true
case "headers":
ck.Headers = cacheKeysConfigurationVMapV.([]string)
for _, header := range cacheKeysConfigurationVMapV.([]interface{}) {
ck.Headers = append(ck.Headers, header.(string))
}
}
}
rg := regexp.MustCompile(cacheKeysConfigurationK)
Expand Down Expand Up @@ -137,7 +139,9 @@ func parseDefaultCache(dcConfiguration map[string]interface{}) *configurationtyp
}
dc.Etcd = provider
case "headers":
dc.Headers = defaultCacheV.([]string)
for _, hv := range defaultCacheV.([]interface{}) {
dc.Headers = append(dc.Headers, hv.(string))
}
case "nuts":
provider := configurationtypes.CacheProvider{}
for nutsConfigurationK, nutsConfigurationV := range defaultCacheV.(map[string]interface{}) {
Expand Down Expand Up @@ -270,7 +274,12 @@ func parseSurrogateKeys(surrogates map[string]interface{}) map[string]configurat
for key, value := range surrogateV.(map[string]interface{}) {
switch key {
case "headers":
surrogate.Headers = value.(map[string]string)
if surrogate.Headers == nil {
surrogate.Headers = make(map[string]string)
}
for hn, hv := range value.(map[string]interface{}) {
surrogate.Headers[hn] = hv.(string)
}
case "url":
surrogate.URL = value.(string)
}
Expand Down

0 comments on commit fd86a57

Please sign in to comment.