From a7ea3121d9560df0224df8d7884f7f79903bc4f9 Mon Sep 17 00:00:00 2001 From: Bolke de Bruin <bolke@xs4all.nl> Date: Tue, 19 Mar 2024 10:23:57 +0100 Subject: [PATCH] Only split when required --- cmd/rdpgw/config/configuration.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/rdpgw/config/configuration.go b/cmd/rdpgw/config/configuration.go index 8e3804d..95a2d10 100644 --- a/cmd/rdpgw/config/configuration.go +++ b/cmd/rdpgw/config/configuration.go @@ -165,10 +165,14 @@ func Load(configFile string) Configuration { key := strings.Replace(strings.ToLower(strings.TrimPrefix(s, "RDPGW_")), "__", ".", -1) key = ToCamel(key) - newVal := strings.Split(strings.Trim(v, " "), " ") - log.Printf("Setting %s to %v", key, newVal) - // handle the case where the value is a list - return key, newVal + v = strings.Trim(v, " ") + + // handle lists + if strings.Contains(v, " ") { + return key, strings.Split(v, " ") + } + return key, v + }), nil); err != nil { log.Fatalf("Error loading config from environment: %v", err) } -- GitLab