remove double ENABLED help output (#16528)

This commit is contained in:
Harshavardhana 2023-02-03 19:22:52 +05:30 committed by GitHub
parent 8ca14e6267
commit aa8b9572b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 69 deletions

View File

@ -701,37 +701,42 @@ func GetHelp(subSys, key string, envOnly bool) (Help, error) {
h = config.HelpKVS{value} h = config.HelpKVS{value}
} }
envHelp := config.HelpKVS{} help := config.HelpKVS{}
if envOnly {
// Only for multiple targets, make sure // Only for multiple targets, make sure
// to list the ENV, for regular k/v EnableKey is // to list the ENV, for regular k/v EnableKey is
// implicit, for ENVs we cannot make it implicit. // implicit, for ENVs we cannot make it implicit.
if subSysHelp.MultipleTargets { if subSysHelp.MultipleTargets {
envK := config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(madmin.EnableKey) key := madmin.EnableKey
envHelp = append(envHelp, config.HelpKV{ if envOnly {
Key: envK, key = config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(madmin.EnableKey)
}
help = append(help, config.HelpKV{
Key: key,
Description: fmt.Sprintf("enable %s target, default is 'off'", subSys), Description: fmt.Sprintf("enable %s target, default is 'off'", subSys),
Optional: false, Optional: false,
Type: "on|off", Type: "on|off",
}) })
} }
for _, hkv := range h { for _, hkv := range h {
envK := config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(hkv.Key) key := hkv.Key
envHelp = append(envHelp, config.HelpKV{ if envOnly {
Key: envK, key = config.EnvPrefix + strings.ToTitle(subSys) + config.EnvWordDelimiter + strings.ToTitle(hkv.Key)
}
help = append(help, config.HelpKV{
Key: key,
Description: hkv.Description, Description: hkv.Description,
Optional: hkv.Optional, Optional: hkv.Optional,
Type: hkv.Type, Type: hkv.Type,
}) })
} }
h = envHelp
}
return Help{ return Help{
SubSys: subSys, SubSys: subSys,
Description: subSysHelp.Description, Description: subSysHelp.Description,
MultipleTargets: subSysHelp.MultipleTargets, MultipleTargets: subSysHelp.MultipleTargets,
KeysHelp: h, KeysHelp: help,
}, nil }, nil
} }

View File

@ -26,13 +26,6 @@ var (
} }
Help = config.HelpKVS{ Help = config.HelpKVS{
config.HelpKV{
Key: config.Enable,
Description: "Enable or disable OpenID",
Type: "on|off",
Optional: true,
Sensitive: false,
},
config.HelpKV{ config.HelpKV{
Key: DisplayName, Key: DisplayName,
Description: "Friendly display name for this Provider/App" + defaultHelpPostfix(DisplayName), Description: "Friendly display name for this Provider/App" + defaultHelpPostfix(DisplayName),

View File

@ -28,18 +28,9 @@ const (
queueLimitComment = `maximum limit for undelivered messages, defaults to '100000'` queueLimitComment = `maximum limit for undelivered messages, defaults to '100000'`
) )
var enableHelp = config.HelpKV{
Key: config.Enable,
Description: "Enable or disable notifications",
Type: "on|off",
Sensitive: false,
Optional: true,
}
// Help template inputs for all notification targets // Help template inputs for all notification targets
var ( var (
HelpWebhook = config.HelpKVS{ HelpWebhook = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.WebhookEndpoint, Key: target.WebhookEndpoint,
Description: "webhook server endpoint e.g. http://localhost:8080/minio/events", Description: "webhook server endpoint e.g. http://localhost:8080/minio/events",
@ -88,7 +79,6 @@ var (
} }
HelpAMQP = config.HelpKVS{ HelpAMQP = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.AmqpURL, Key: target.AmqpURL,
Description: "AMQP server endpoint e.g. `amqp://myuser:mypassword@localhost:5672`", Description: "AMQP server endpoint e.g. `amqp://myuser:mypassword@localhost:5672`",
@ -177,7 +167,6 @@ var (
} }
HelpKafka = config.HelpKVS{ HelpKafka = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.KafkaBrokers, Key: target.KafkaBrokers,
Description: "comma separated list of Kafka broker addresses", Description: "comma separated list of Kafka broker addresses",
@ -274,7 +263,6 @@ var (
} }
HelpMQTT = config.HelpKVS{ HelpMQTT = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.MqttBroker, Key: target.MqttBroker,
Description: "MQTT server endpoint e.g. `tcp://localhost:1883`", Description: "MQTT server endpoint e.g. `tcp://localhost:1883`",
@ -339,7 +327,6 @@ var (
} }
HelpPostgres = config.HelpKVS{ HelpPostgres = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.PostgresConnectionString, Key: target.PostgresConnectionString,
Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`,
@ -383,7 +370,6 @@ var (
} }
HelpMySQL = config.HelpKVS{ HelpMySQL = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.MySQLDSNString, Key: target.MySQLDSNString,
Description: `MySQL data-source-name connection string e.g. "<user>:<password>@tcp(<host>:<port>)/<database>"`, Description: `MySQL data-source-name connection string e.g. "<user>:<password>@tcp(<host>:<port>)/<database>"`,
@ -428,7 +414,6 @@ var (
} }
HelpNATS = config.HelpKVS{ HelpNATS = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.NATSAddress, Key: target.NATSAddress,
Description: "NATS server address e.g. '0.0.0.0:4222'", Description: "NATS server address e.g. '0.0.0.0:4222'",
@ -551,7 +536,6 @@ var (
} }
HelpNSQ = config.HelpKVS{ HelpNSQ = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.NSQAddress, Key: target.NSQAddress,
Description: "NSQ server address e.g. '127.0.0.1:4150'", Description: "NSQ server address e.g. '127.0.0.1:4150'",
@ -596,7 +580,6 @@ var (
} }
HelpES = config.HelpKVS{ HelpES = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.ElasticURL, Key: target.ElasticURL,
Description: "Elasticsearch server's address, with optional authentication info", Description: "Elasticsearch server's address, with optional authentication info",
@ -648,7 +631,6 @@ var (
} }
HelpRedis = config.HelpKVS{ HelpRedis = config.HelpKVS{
enableHelp,
config.HelpKV{ config.HelpKV{
Key: target.RedisAddress, Key: target.RedisAddress,
Description: "Redis server's address. For example: `localhost:6379`", Description: "Redis server's address. For example: `localhost:6379`",

View File

@ -24,13 +24,6 @@ import (
// Help template for logger http and audit // Help template for logger http and audit
var ( var (
Help = config.HelpKVS{ Help = config.HelpKVS{
config.HelpKV{
Key: config.Enable,
Description: "set to 'on' to enable the logger webhook",
Optional: true,
Type: "on|off",
Sensitive: false,
},
config.HelpKV{ config.HelpKV{
Key: Endpoint, Key: Endpoint,
Description: `HTTP(s) endpoint e.g. "http://localhost:8080/minio/logs/server"`, Description: `HTTP(s) endpoint e.g. "http://localhost:8080/minio/logs/server"`,
@ -73,13 +66,6 @@ var (
} }
HelpWebhook = config.HelpKVS{ HelpWebhook = config.HelpKVS{
config.HelpKV{
Key: config.Enable,
Description: "set to 'on' to enable the audit logger",
Optional: true,
Type: "on|off",
Sensitive: false,
},
config.HelpKV{ config.HelpKV{
Key: Endpoint, Key: Endpoint,
Description: `HTTP(s) endpoint e.g. "http://localhost:8080/minio/logs/audit"`, Description: `HTTP(s) endpoint e.g. "http://localhost:8080/minio/logs/audit"`,
@ -122,13 +108,6 @@ var (
} }
HelpKafka = config.HelpKVS{ HelpKafka = config.HelpKVS{
config.HelpKV{
Key: config.Enable,
Description: "set to 'on' to enable kafka audit logging",
Optional: true,
Type: "on|off",
Sensitive: false,
},
config.HelpKV{ config.HelpKV{
Key: KafkaBrokers, Key: KafkaBrokers,
Description: "comma separated list of Kafka broker addresses", Description: "comma separated list of Kafka broker addresses",