mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Do not add comments after migration (#8530)
Also filter out empty comments from being printed.
This commit is contained in:
parent
a8e156d6a5
commit
13a3d17321
@ -18,6 +18,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@ -288,7 +289,11 @@ var helpMap = map[string]config.HelpKV{
|
||||
// GetHelp - returns help for sub-sys, a key for a sub-system or all the help.
|
||||
func GetHelp(subSys, key string, envOnly bool) (config.HelpKV, error) {
|
||||
if len(subSys) == 0 {
|
||||
return nil, config.Error("no help available for empty sub-system inputs")
|
||||
help := config.HelpKV{}
|
||||
for _, subSys := range config.SubSystems.ToSlice() {
|
||||
help[subSys] = fmt.Sprintf("Specify sub-sys '%s' to get further help", subSys)
|
||||
}
|
||||
return help, nil
|
||||
}
|
||||
subSystemValue := strings.SplitN(subSys, config.SubSystemSeparator, 2)
|
||||
if len(subSystemValue) == 0 {
|
||||
|
1
cmd/config/cache/legacy.go
vendored
1
cmd/config/cache/legacy.go
vendored
@ -35,5 +35,4 @@ func SetCacheConfig(s config.Config, cfg Config) {
|
||||
s[config.CacheSubSys][config.Default][Expiry] = fmt.Sprintf("%d", cfg.Expiry)
|
||||
s[config.CacheSubSys][config.Default][Quota] = fmt.Sprintf("%d", cfg.MaxUse)
|
||||
s[config.CacheSubSys][config.Default][config.State] = config.StateOn
|
||||
s[config.CacheSubSys][config.Default][config.Comment] = "Settings for Cache, after migrating config"
|
||||
}
|
||||
|
@ -35,9 +35,8 @@ func SetCompressionConfig(s config.Config, cfg Config) {
|
||||
return
|
||||
}
|
||||
s[config.CompressionSubSys][config.Default] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Compression, after migrating config",
|
||||
Extensions: strings.Join(cfg.Extensions, config.ValueSeparator),
|
||||
MimeTypes: strings.Join(cfg.MimeTypes, config.ValueSeparator),
|
||||
config.State: config.StateOn,
|
||||
Extensions: strings.Join(cfg.Extensions, config.ValueSeparator),
|
||||
MimeTypes: strings.Join(cfg.MimeTypes, config.ValueSeparator),
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ func SetIdentityLDAP(s config.Config, ldapArgs Config) {
|
||||
}
|
||||
s[config.IdentityLDAPSubSys][config.Default] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for LDAP, after migrating config",
|
||||
ServerAddr: ldapArgs.ServerAddr,
|
||||
STSExpiry: ldapArgs.STSExpiryDuration,
|
||||
UsernameFormat: ldapArgs.UsernameFormat,
|
||||
|
@ -30,10 +30,9 @@ func SetIdentityOpenID(s config.Config, cfg Config) {
|
||||
return
|
||||
}
|
||||
s[config.IdentityOpenIDSubSys][config.Default] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for OpenID, after migrating config",
|
||||
JwksURL: cfg.JWKS.URL.String(),
|
||||
ConfigURL: "",
|
||||
ClaimPrefix: "",
|
||||
config.State: config.StateOn,
|
||||
JwksURL: cfg.JWKS.URL.String(),
|
||||
ConfigURL: "",
|
||||
ClaimPrefix: "",
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ func SetCredentials(c Config, cred auth.Credentials) {
|
||||
}
|
||||
c[CredentialsSubSys][Default] = KVS{
|
||||
State: StateOn,
|
||||
Comment: "Settings for credentials, after migrating config",
|
||||
AccessKey: cred.AccessKey,
|
||||
SecretKey: cred.SecretKey,
|
||||
}
|
||||
@ -46,7 +45,6 @@ func SetRegion(c Config, name string) {
|
||||
c[RegionSubSys][Default] = KVS{
|
||||
RegionName: name,
|
||||
State: StateOn,
|
||||
Comment: "Settings for Region, after migrating config",
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +56,6 @@ func SetWorm(c Config, b bool) {
|
||||
}
|
||||
// Set the new value.
|
||||
c[WormSubSys][Default] = KVS{
|
||||
State: StateOn,
|
||||
Comment: "Settings for WORM, after migrating config",
|
||||
State: StateOn,
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ func SetNotifyKafka(s config.Config, kName string, cfg target.KafkaArgs) error {
|
||||
}
|
||||
return strings.Join(brokers, config.ValueSeparator)
|
||||
}(),
|
||||
config.Comment: "Settings for Kafka notification, after migrating config",
|
||||
target.KafkaTopic: cfg.Topic,
|
||||
target.KafkaQueueDir: cfg.QueueDir,
|
||||
target.KafkaQueueLimit: strconv.Itoa(int(cfg.QueueLimit)),
|
||||
@ -54,7 +53,6 @@ func SetNotifyAMQP(s config.Config, amqpName string, cfg target.AMQPArgs) error
|
||||
|
||||
s[config.NotifyAMQPSubSys][amqpName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for AMQP notification, after migrating config",
|
||||
target.AmqpURL: cfg.URL.String(),
|
||||
target.AmqpExchange: cfg.Exchange,
|
||||
target.AmqpRoutingKey: cfg.RoutingKey,
|
||||
@ -84,7 +82,6 @@ func SetNotifyES(s config.Config, esName string, cfg target.ElasticsearchArgs) e
|
||||
|
||||
s[config.NotifyESSubSys][esName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Elasticsearch notification, after migrating config",
|
||||
target.ElasticFormat: cfg.Format,
|
||||
target.ElasticURL: cfg.URL.String(),
|
||||
target.ElasticIndex: cfg.Index,
|
||||
@ -107,7 +104,6 @@ func SetNotifyRedis(s config.Config, redisName string, cfg target.RedisArgs) err
|
||||
|
||||
s[config.NotifyRedisSubSys][redisName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Redis notification, after migrating config",
|
||||
target.RedisFormat: cfg.Format,
|
||||
target.RedisAddress: cfg.Addr.String(),
|
||||
target.RedisPassword: cfg.Password,
|
||||
@ -131,7 +127,6 @@ func SetNotifyWebhook(s config.Config, whName string, cfg target.WebhookArgs) er
|
||||
|
||||
s[config.NotifyWebhookSubSys][whName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Webhook notification, after migrating config",
|
||||
target.WebhookEndpoint: cfg.Endpoint.String(),
|
||||
target.WebhookAuthToken: cfg.AuthToken,
|
||||
target.WebhookQueueDir: cfg.QueueDir,
|
||||
@ -153,7 +148,6 @@ func SetNotifyPostgres(s config.Config, psqName string, cfg target.PostgreSQLArg
|
||||
|
||||
s[config.NotifyPostgresSubSys][psqName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Postgres notification, after migrating config",
|
||||
target.PostgresFormat: cfg.Format,
|
||||
target.PostgresConnectionString: cfg.ConnectionString,
|
||||
target.PostgresTable: cfg.Table,
|
||||
@ -181,7 +175,6 @@ func SetNotifyNSQ(s config.Config, nsqName string, cfg target.NSQArgs) error {
|
||||
|
||||
s[config.NotifyNSQSubSys][nsqName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for NSQ notification, after migrating config",
|
||||
target.NSQAddress: cfg.NSQDAddress.String(),
|
||||
target.NSQTopic: cfg.Topic,
|
||||
target.NSQTLS: config.FormatBool(cfg.TLS.Enable),
|
||||
@ -205,7 +198,6 @@ func SetNotifyNATS(s config.Config, natsName string, cfg target.NATSArgs) error
|
||||
|
||||
s[config.NotifyNATSSubSys][natsName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for NATS notification, after migrating config",
|
||||
target.NATSAddress: cfg.Address.String(),
|
||||
target.NATSSubject: cfg.Subject,
|
||||
target.NATSUsername: cfg.Username,
|
||||
@ -244,7 +236,6 @@ func SetNotifyMySQL(s config.Config, sqlName string, cfg target.MySQLArgs) error
|
||||
|
||||
s[config.NotifyMySQLSubSys][sqlName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for MySQL notification, after migrating config",
|
||||
target.MySQLFormat: cfg.Format,
|
||||
target.MySQLDSNString: cfg.DSN,
|
||||
target.MySQLTable: cfg.Table,
|
||||
@ -272,7 +263,6 @@ func SetNotifyMQTT(s config.Config, mqttName string, cfg target.MQTTArgs) error
|
||||
|
||||
s[config.NotifyMQTTSubSys][mqttName] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for MQTT notification, after migrating config",
|
||||
target.MqttBroker: cfg.Broker.String(),
|
||||
target.MqttTopic: cfg.Topic,
|
||||
target.MqttQoS: fmt.Sprintf("%d", cfg.QoS),
|
||||
|
@ -33,9 +33,8 @@ func SetPolicyOPAConfig(s config.Config, opaArgs Args) {
|
||||
return
|
||||
}
|
||||
s[config.PolicyOPASubSys][config.Default] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for OPA, after migrating config",
|
||||
URL: opaArgs.URL.String(),
|
||||
AuthToken: opaArgs.AuthToken,
|
||||
config.State: config.StateOn,
|
||||
URL: opaArgs.URL.String(),
|
||||
AuthToken: opaArgs.AuthToken,
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,8 @@ func SetStorageClass(s config.Config, cfg Config) {
|
||||
return
|
||||
}
|
||||
s[config.StorageClassSubSys][config.Default] = config.KVS{
|
||||
ClassStandard: cfg.Standard.String(),
|
||||
ClassRRS: cfg.RRS.String(),
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for StorageClass, after migrating config",
|
||||
ClassStandard: cfg.Standard.String(),
|
||||
ClassRRS: cfg.RRS.String(),
|
||||
config.State: config.StateOn,
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,6 @@ func SetKMSConfig(s config.Config, cfg KMSConfig) {
|
||||
KMSVaultKeyVersion: strconv.Itoa(cfg.Vault.Key.Version),
|
||||
KMSVaultNamespace: cfg.Vault.Namespace,
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for KMS Vault, after migrating config",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,9 @@ func SetLoggerHTTPAudit(scfg config.Config, k string, args HTTP) {
|
||||
return
|
||||
}
|
||||
scfg[config.AuditWebhookSubSys][k] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Webhook Audit logging, after migrating config",
|
||||
Endpoint: args.Endpoint,
|
||||
AuthToken: args.AuthToken,
|
||||
config.State: config.StateOn,
|
||||
Endpoint: args.Endpoint,
|
||||
AuthToken: args.AuthToken,
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,9 +44,8 @@ func SetLoggerHTTP(scfg config.Config, k string, args HTTP) {
|
||||
}
|
||||
|
||||
scfg[config.LoggerWebhookSubSys][k] = config.KVS{
|
||||
config.State: config.StateOn,
|
||||
config.Comment: "Settings for Webhook logging, after migrating config",
|
||||
Endpoint: args.Endpoint,
|
||||
AuthToken: args.AuthToken,
|
||||
config.State: config.StateOn,
|
||||
Endpoint: args.Endpoint,
|
||||
AuthToken: args.AuthToken,
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,9 @@ func (kvs KVS) String() string {
|
||||
if k == stateKey && v == stateOn {
|
||||
continue
|
||||
}
|
||||
if k == commentKey && v == "" {
|
||||
continue
|
||||
}
|
||||
s.WriteString(k)
|
||||
s.WriteString(KvSeparator)
|
||||
spc := hasSpace(v)
|
||||
@ -96,7 +99,6 @@ func (t Targets) String() string {
|
||||
s.WriteString(kv.String())
|
||||
if (len(t) > 1 || len(targetKV) > 1) && count > 0 {
|
||||
s.WriteString(KvNewline)
|
||||
s.WriteString(KvNewline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user