From 792c2eafb8d2ff0115dfbf6418c5e173c3677798 Mon Sep 17 00:00:00 2001 From: David Hontecillas Date: Wed, 17 Jul 2024 19:54:12 +0200 Subject: [PATCH] Fix not loading map options --- httpsecure.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/httpsecure.go b/httpsecure.go index 1588199..9e1c71d 100644 --- a/httpsecure.go +++ b/httpsecure.go @@ -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 } @@ -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) {