mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Fix env var output in config get/export APIs (#15528)
Fix a bug where env vars are not output when the config for the subsystem is specified solely via env vars.
This commit is contained in:
parent
c5b3666089
commit
9986e103cf
@ -436,24 +436,24 @@ func (a adminAPIHandlers) GetConfigHandler(w http.ResponseWriter, r *http.Reques
|
||||
cfgSubsysItems, _ := cfg.GetSubsysInfo(hkv.Key)
|
||||
|
||||
for _, item := range cfgSubsysItems {
|
||||
off := item.Params.Get(config.Enable) == config.EnableOff
|
||||
off := item.Config.Get(config.Enable) == config.EnableOff
|
||||
switch hkv.Key {
|
||||
case config.EtcdSubSys:
|
||||
off = !etcd.Enabled(item.Params)
|
||||
off = !etcd.Enabled(item.Config)
|
||||
case config.CacheSubSys:
|
||||
off = !cache.Enabled(item.Params)
|
||||
off = !cache.Enabled(item.Config)
|
||||
case config.StorageClassSubSys:
|
||||
off = !storageclass.Enabled(item.Params)
|
||||
off = !storageclass.Enabled(item.Config)
|
||||
case config.PolicyPluginSubSys:
|
||||
off = !polplugin.Enabled(item.Params)
|
||||
off = !polplugin.Enabled(item.Config)
|
||||
case config.IdentityOpenIDSubSys:
|
||||
off = !openid.Enabled(item.Params)
|
||||
off = !openid.Enabled(item.Config)
|
||||
case config.IdentityLDAPSubSys:
|
||||
off = !xldap.Enabled(item.Params)
|
||||
off = !xldap.Enabled(item.Config)
|
||||
case config.IdentityTLSSubSys:
|
||||
off = !globalSTSTLSConfig.Enabled
|
||||
case config.IdentityPluginSubSys:
|
||||
off = !idplugin.Enabled(item.Params)
|
||||
off = !idplugin.Enabled(item.Config)
|
||||
}
|
||||
item.AddString(&s, off)
|
||||
}
|
||||
|
@ -1217,7 +1217,8 @@ type EnvPair struct {
|
||||
// SubsysInfo holds config info for a subsystem target.
|
||||
type SubsysInfo struct {
|
||||
SubSys, Target string
|
||||
Params KVS
|
||||
Defaults KVS
|
||||
Config KVS
|
||||
|
||||
// map of config parameter name to EnvPair.
|
||||
EnvMap map[string]EnvPair
|
||||
@ -1248,10 +1249,11 @@ func (c Config) GetSubsysInfo(subSys string) ([]SubsysInfo, error) {
|
||||
for _, target := range targets {
|
||||
kvs := c.getTargetKVS(subSys, target)
|
||||
cs := SubsysInfo{
|
||||
SubSys: subSys,
|
||||
Target: target,
|
||||
Params: kvs,
|
||||
EnvMap: make(map[string]EnvPair),
|
||||
SubSys: subSys,
|
||||
Target: target,
|
||||
Defaults: defKVS,
|
||||
Config: kvs,
|
||||
EnvMap: make(map[string]EnvPair),
|
||||
}
|
||||
|
||||
// Add all env vars that are set.
|
||||
@ -1274,7 +1276,7 @@ func (c Config) GetSubsysInfo(subSys string) ([]SubsysInfo, error) {
|
||||
|
||||
// AddEnvString adds env vars to the given string builder.
|
||||
func (cs *SubsysInfo) AddEnvString(b *strings.Builder) {
|
||||
for _, v := range cs.Params {
|
||||
for _, v := range cs.Defaults {
|
||||
if ep, ok := cs.EnvMap[v.Key]; ok {
|
||||
b.WriteString(KvComment)
|
||||
b.WriteString(KvSpaceSeparator)
|
||||
@ -1301,6 +1303,6 @@ func (cs *SubsysInfo) AddString(b *strings.Builder, off bool) {
|
||||
b.WriteString(cs.Target)
|
||||
}
|
||||
b.WriteString(KvSpaceSeparator)
|
||||
b.WriteString(cs.Params.String())
|
||||
b.WriteString(cs.Config.String())
|
||||
b.WriteString(KvNewline)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user