Skip to content

Commit c27cef3

Browse files
committed
Switch to strings.SplitN() for env parsing
1 parent 2ff02e0 commit c27cef3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

plugin.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,16 @@ func parseEnv(raw interface{}) (map[string]string, error) {
443443

444444
result := make(map[string]string)
445445
for _, v := range raw.([]interface{}) {
446-
split := strings.Split(v.(string), "=")
447-
key, value := strings.TrimSpace(split[0]), split[1:]
446+
split := strings.SplitN(v.(string), "=", 2)
447+
key := strings.TrimSpace(split[0])
448448

449449
// only key exists. set value from env
450-
if len(key) > 0 && len(value) == 0 {
450+
if len(key) > 0 && len(split) == 1 {
451451
result[key] = env(key, "")
452452
}
453453

454-
if len(value) > 0 {
455-
result[key] = strings.TrimSpace(value[0])
454+
if len(split) == 2 {
455+
result[key] = strings.TrimSpace(split[1])
456456
}
457457
}
458458

0 commit comments

Comments
 (0)