mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-08-22 08:10:49 +02:00
Only split when required
This commit is contained in:
parent
7bf2a59838
commit
a7ea3121d9
1 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue