From ec63346c8a8ead4477cf65ce7ae683eb3c3aec79 Mon Sep 17 00:00:00 2001
From: Bolke de Bruin <bolke@xs4all.nl>
Date: Tue, 19 Mar 2024 09:42:19 +0100
Subject: [PATCH] Handle arrays in env variables

---
 cmd/rdpgw/config/configuration.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmd/rdpgw/config/configuration.go b/cmd/rdpgw/config/configuration.go
index 43e6761..7791f57 100644
--- a/cmd/rdpgw/config/configuration.go
+++ b/cmd/rdpgw/config/configuration.go
@@ -164,7 +164,9 @@ func Load(configFile string) Configuration {
 	if err := k.Load(env.ProviderWithValue("RDPGW_", ".", func(s string, v string) (string, interface{}) {
 		key := strings.Replace(strings.ToLower(strings.TrimPrefix(s, "RDPGW_")), "__", ".", -1)
 		key = ToCamel(key)
-		return key, v
+
+		// handle the case where the value is a list
+		return key, strings.Split(strings.Trim(v, " "), " ")
 	}), nil); err != nil {
 		log.Fatalf("Error loading config from environment: %v", err)
 	}
-- 
GitLab