Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix not loading map options #16

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading