Refine: case insensitive & trim space (#193)

This commit is contained in:
Loyalsoldier 2020-09-05 07:08:33 +08:00 committed by GitHub
parent 916fcaec40
commit debbefc4cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,8 +287,8 @@ func getRuntimeEnv(key string) (string, error) {
for _, envItem := range envStrings {
envItem = strings.TrimSuffix(envItem, "\r")
envKeyValue := strings.Split(envItem, "=")
if strings.ToLower(envKeyValue[0]) == strings.ToLower(key) {
runtimeEnv = envKeyValue[1]
if strings.EqualFold(strings.TrimSpace(envKeyValue[0]), strings.TrimSpace(key)) {
runtimeEnv = strings.TrimSpace(envKeyValue[1])
}
}
return runtimeEnv, nil