Only split when required

This commit is contained in:
Bolke de Bruin 2024-03-19 10:23:57 +01:00
parent 7bf2a59838
commit a7ea3121d9

View file

@ -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)
}