Skip to content

Commit

Permalink
Merge pull request #16 from krakend/fix_not_reading_strings_map
Browse files Browse the repository at this point in the history
Fix not loading map options
  • Loading branch information
kpacha authored Jul 17, 2024
2 parents b12fe59 + 792c2ea commit 67c832e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions httpsecure.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ func ConfigGetter(e config.ExtraConfig) interface{} {
getBool(tmp, "frame_deny", &cfg.FrameDeny)
getBool(tmp, "ssl_redirect", &cfg.SSLRedirect)

getStringMap(tmp, "ssl_proxy_headers", &cfg.SSLProxyHeaders)

cfg.SSLProxyHeaders = getStringMap(tmp, "ssl_proxy_headers")
return cfg
}

Expand All @@ -71,22 +70,23 @@ func getStrings(data map[string]interface{}, key string, v *[]string) {
*v = result
}

func getStringMap(data map[string]interface{}, key string, v *map[string]string) {
if v == nil {
return
}
func getStringMap(data map[string]interface{}, key string) map[string]string {
im, ok := data[key]
if !ok {
return
return nil
}
m, ok := im.(map[string]string)
mi, ok := im.(map[string]interface{})
if !ok {
return
return nil
}

for mk, mv := range m {
(*v)[mk] = mv
nm := make(map[string]string, len(mi))
for mk, mv := range mi {
if s, ok := mv.(string); ok {
nm[mk] = s
}
}
return nm
}

func getString(data map[string]interface{}, key string, v *string) {
Expand Down

0 comments on commit 67c832e

Please sign in to comment.