mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon: use strings.Cut() and cleanup error messages
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -38,16 +38,16 @@ func merge(userConf, imageConf *containertypes.Config) error {
|
||||
} else {
|
||||
for _, imageEnv := range imageConf.Env {
|
||||
found := false
|
||||
imageEnvKey := strings.Split(imageEnv, "=")[0]
|
||||
imageEnvKey, _, _ := strings.Cut(imageEnv, "=")
|
||||
for _, userEnv := range userConf.Env {
|
||||
userEnvKey := strings.Split(userEnv, "=")[0]
|
||||
userEnvKey, _, _ := strings.Cut(userEnv, "=")
|
||||
if isWindows {
|
||||
// Case insensitive environment variables on Windows
|
||||
imageEnvKey = strings.ToUpper(imageEnvKey)
|
||||
userEnvKey = strings.ToUpper(userEnvKey)
|
||||
found = strings.EqualFold(imageEnvKey, userEnvKey)
|
||||
} else {
|
||||
found = imageEnvKey == userEnvKey
|
||||
}
|
||||
if imageEnvKey == userEnvKey {
|
||||
found = true
|
||||
if found {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user