mirror of
https://github.com/minio/minio.git
synced 2024-12-25 22:55:54 -05:00
fix: parse the subsys env error (#18319)
This commit is contained in:
parent
54aed421b8
commit
dbc2368a7b
@ -1091,6 +1091,8 @@ func (c Config) GetAvailableTargets(subSys string) ([]string, error) {
|
|||||||
seen.Add(k)
|
seen.Add(k)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// env:prefix
|
||||||
|
filterMap := map[string]string{}
|
||||||
// Add targets that are configured via environment variables.
|
// Add targets that are configured via environment variables.
|
||||||
for _, param := range defKVS {
|
for _, param := range defKVS {
|
||||||
envVarPrefix := getEnvVarName(subSys, Default, param.Key) + Default
|
envVarPrefix := getEnvVarName(subSys, Default, param.Key) + Default
|
||||||
@ -1098,11 +1100,21 @@ func (c Config) GetAvailableTargets(subSys string) ([]string, error) {
|
|||||||
for _, k := range envsWithPrefix {
|
for _, k := range envsWithPrefix {
|
||||||
tgtName := strings.TrimPrefix(k, envVarPrefix)
|
tgtName := strings.TrimPrefix(k, envVarPrefix)
|
||||||
if tgtName != "" {
|
if tgtName != "" {
|
||||||
seen.Add(tgtName)
|
if v, ok := filterMap[k]; ok {
|
||||||
|
if strings.HasPrefix(envVarPrefix, v) {
|
||||||
|
filterMap[k] = envVarPrefix
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filterMap[k] = envVarPrefix
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for k, v := range filterMap {
|
||||||
|
seen.Add(strings.TrimPrefix(k, v))
|
||||||
|
}
|
||||||
|
|
||||||
seen.Remove(Default)
|
seen.Remove(Default)
|
||||||
targets := seen.ToSlice()
|
targets := seen.ToSlice()
|
||||||
sort.Strings(targets)
|
sort.Strings(targets)
|
||||||
|
Loading…
Reference in New Issue
Block a user