diff --git a/cmd/common-main.go b/cmd/common-main.go index e0f1f1e06..fc1501e18 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -490,6 +490,12 @@ func parsEnvEntry(envEntry string) (envKV, error) { Skip: true, }, nil } + if strings.HasPrefix(envEntry, "#") { + // Skip commented lines + return envKV{ + Skip: true, + }, nil + } const envSeparator = "=" envTokens := strings.SplitN(strings.TrimSpace(strings.TrimPrefix(envEntry, "export")), envSeparator, 2) if len(envTokens) != 2 { @@ -499,13 +505,6 @@ func parsEnvEntry(envEntry string) (envKV, error) { key := envTokens[0] val := envTokens[1] - if strings.HasPrefix(key, "#") { - // Skip commented lines - return envKV{ - Skip: true, - }, nil - } - // Remove quotes from the value if found if len(val) >= 2 { quote := val[0] diff --git a/cmd/common-main_test.go b/cmd/common-main_test.go index b5c0b5518..b8ae673db 100644 --- a/cmd/common-main_test.go +++ b/cmd/common-main_test.go @@ -136,6 +136,7 @@ export MINIO_ROOT_PASSWORD=minio123`, }, { ` +# simple comment # MINIO_ROOT_USER=minioadmin # MINIO_ROOT_PASSWORD=minioadmin MINIO_ROOT_USER=minio