mirror of
https://github.com/minio/minio.git
synced 2025-05-21 09:33:50 -04:00
fix: cant parse comment without '=' in environment file (#15130)
This commit is contained in:
parent
cd7a0a9757
commit
e2e5bd6f19
@ -490,6 +490,12 @@ func parsEnvEntry(envEntry string) (envKV, error) {
|
|||||||
Skip: true,
|
Skip: true,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(envEntry, "#") {
|
||||||
|
// Skip commented lines
|
||||||
|
return envKV{
|
||||||
|
Skip: true,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
const envSeparator = "="
|
const envSeparator = "="
|
||||||
envTokens := strings.SplitN(strings.TrimSpace(strings.TrimPrefix(envEntry, "export")), envSeparator, 2)
|
envTokens := strings.SplitN(strings.TrimSpace(strings.TrimPrefix(envEntry, "export")), envSeparator, 2)
|
||||||
if len(envTokens) != 2 {
|
if len(envTokens) != 2 {
|
||||||
@ -499,13 +505,6 @@ func parsEnvEntry(envEntry string) (envKV, error) {
|
|||||||
key := envTokens[0]
|
key := envTokens[0]
|
||||||
val := envTokens[1]
|
val := envTokens[1]
|
||||||
|
|
||||||
if strings.HasPrefix(key, "#") {
|
|
||||||
// Skip commented lines
|
|
||||||
return envKV{
|
|
||||||
Skip: true,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove quotes from the value if found
|
// Remove quotes from the value if found
|
||||||
if len(val) >= 2 {
|
if len(val) >= 2 {
|
||||||
quote := val[0]
|
quote := val[0]
|
||||||
|
@ -136,6 +136,7 @@ export MINIO_ROOT_PASSWORD=minio123`,
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
`
|
`
|
||||||
|
# simple comment
|
||||||
# MINIO_ROOT_USER=minioadmin
|
# MINIO_ROOT_USER=minioadmin
|
||||||
# MINIO_ROOT_PASSWORD=minioadmin
|
# MINIO_ROOT_PASSWORD=minioadmin
|
||||||
MINIO_ROOT_USER=minio
|
MINIO_ROOT_USER=minio
|
||||||
|
Loading…
x
Reference in New Issue
Block a user