mirror of https://github.com/minio/minio.git
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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"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.
|
// 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) {
|
func GetHelp(subSys, key string, envOnly bool) (config.HelpKV, error) {
|
||||||
if len(subSys) == 0 {
|
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)
|
subSystemValue := strings.SplitN(subSys, config.SubSystemSeparator, 2)
|
||||||
if len(subSystemValue) == 0 {
|
if len(subSystemValue) == 0 {
|
||||||
|
|
|
@ -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][Expiry] = fmt.Sprintf("%d", cfg.Expiry)
|
||||||
s[config.CacheSubSys][config.Default][Quota] = fmt.Sprintf("%d", cfg.MaxUse)
|
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.State] = config.StateOn
|
||||||
s[config.CacheSubSys][config.Default][config.Comment] = "Settings for Cache, after migrating config"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ func SetCompressionConfig(s config.Config, cfg Config) {
|
||||||
}
|
}
|
||||||
s[config.CompressionSubSys][config.Default] = config.KVS{
|
s[config.CompressionSubSys][config.Default] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Compression, after migrating config",
|
|
||||||
Extensions: strings.Join(cfg.Extensions, config.ValueSeparator),
|
Extensions: strings.Join(cfg.Extensions, config.ValueSeparator),
|
||||||
MimeTypes: strings.Join(cfg.MimeTypes, 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{
|
s[config.IdentityLDAPSubSys][config.Default] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for LDAP, after migrating config",
|
|
||||||
ServerAddr: ldapArgs.ServerAddr,
|
ServerAddr: ldapArgs.ServerAddr,
|
||||||
STSExpiry: ldapArgs.STSExpiryDuration,
|
STSExpiry: ldapArgs.STSExpiryDuration,
|
||||||
UsernameFormat: ldapArgs.UsernameFormat,
|
UsernameFormat: ldapArgs.UsernameFormat,
|
||||||
|
|
|
@ -31,7 +31,6 @@ func SetIdentityOpenID(s config.Config, cfg Config) {
|
||||||
}
|
}
|
||||||
s[config.IdentityOpenIDSubSys][config.Default] = config.KVS{
|
s[config.IdentityOpenIDSubSys][config.Default] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for OpenID, after migrating config",
|
|
||||||
JwksURL: cfg.JWKS.URL.String(),
|
JwksURL: cfg.JWKS.URL.String(),
|
||||||
ConfigURL: "",
|
ConfigURL: "",
|
||||||
ClaimPrefix: "",
|
ClaimPrefix: "",
|
||||||
|
|
|
@ -32,7 +32,6 @@ func SetCredentials(c Config, cred auth.Credentials) {
|
||||||
}
|
}
|
||||||
c[CredentialsSubSys][Default] = KVS{
|
c[CredentialsSubSys][Default] = KVS{
|
||||||
State: StateOn,
|
State: StateOn,
|
||||||
Comment: "Settings for credentials, after migrating config",
|
|
||||||
AccessKey: cred.AccessKey,
|
AccessKey: cred.AccessKey,
|
||||||
SecretKey: cred.SecretKey,
|
SecretKey: cred.SecretKey,
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,6 @@ func SetRegion(c Config, name string) {
|
||||||
c[RegionSubSys][Default] = KVS{
|
c[RegionSubSys][Default] = KVS{
|
||||||
RegionName: name,
|
RegionName: name,
|
||||||
State: StateOn,
|
State: StateOn,
|
||||||
Comment: "Settings for Region, after migrating config",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +57,5 @@ func SetWorm(c Config, b bool) {
|
||||||
// Set the new value.
|
// Set the new value.
|
||||||
c[WormSubSys][Default] = KVS{
|
c[WormSubSys][Default] = KVS{
|
||||||
State: StateOn,
|
State: StateOn,
|
||||||
Comment: "Settings for WORM, after migrating config",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ func SetNotifyKafka(s config.Config, kName string, cfg target.KafkaArgs) error {
|
||||||
}
|
}
|
||||||
return strings.Join(brokers, config.ValueSeparator)
|
return strings.Join(brokers, config.ValueSeparator)
|
||||||
}(),
|
}(),
|
||||||
config.Comment: "Settings for Kafka notification, after migrating config",
|
|
||||||
target.KafkaTopic: cfg.Topic,
|
target.KafkaTopic: cfg.Topic,
|
||||||
target.KafkaQueueDir: cfg.QueueDir,
|
target.KafkaQueueDir: cfg.QueueDir,
|
||||||
target.KafkaQueueLimit: strconv.Itoa(int(cfg.QueueLimit)),
|
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{
|
s[config.NotifyAMQPSubSys][amqpName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for AMQP notification, after migrating config",
|
|
||||||
target.AmqpURL: cfg.URL.String(),
|
target.AmqpURL: cfg.URL.String(),
|
||||||
target.AmqpExchange: cfg.Exchange,
|
target.AmqpExchange: cfg.Exchange,
|
||||||
target.AmqpRoutingKey: cfg.RoutingKey,
|
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{
|
s[config.NotifyESSubSys][esName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Elasticsearch notification, after migrating config",
|
|
||||||
target.ElasticFormat: cfg.Format,
|
target.ElasticFormat: cfg.Format,
|
||||||
target.ElasticURL: cfg.URL.String(),
|
target.ElasticURL: cfg.URL.String(),
|
||||||
target.ElasticIndex: cfg.Index,
|
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{
|
s[config.NotifyRedisSubSys][redisName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Redis notification, after migrating config",
|
|
||||||
target.RedisFormat: cfg.Format,
|
target.RedisFormat: cfg.Format,
|
||||||
target.RedisAddress: cfg.Addr.String(),
|
target.RedisAddress: cfg.Addr.String(),
|
||||||
target.RedisPassword: cfg.Password,
|
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{
|
s[config.NotifyWebhookSubSys][whName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Webhook notification, after migrating config",
|
|
||||||
target.WebhookEndpoint: cfg.Endpoint.String(),
|
target.WebhookEndpoint: cfg.Endpoint.String(),
|
||||||
target.WebhookAuthToken: cfg.AuthToken,
|
target.WebhookAuthToken: cfg.AuthToken,
|
||||||
target.WebhookQueueDir: cfg.QueueDir,
|
target.WebhookQueueDir: cfg.QueueDir,
|
||||||
|
@ -153,7 +148,6 @@ func SetNotifyPostgres(s config.Config, psqName string, cfg target.PostgreSQLArg
|
||||||
|
|
||||||
s[config.NotifyPostgresSubSys][psqName] = config.KVS{
|
s[config.NotifyPostgresSubSys][psqName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Postgres notification, after migrating config",
|
|
||||||
target.PostgresFormat: cfg.Format,
|
target.PostgresFormat: cfg.Format,
|
||||||
target.PostgresConnectionString: cfg.ConnectionString,
|
target.PostgresConnectionString: cfg.ConnectionString,
|
||||||
target.PostgresTable: cfg.Table,
|
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{
|
s[config.NotifyNSQSubSys][nsqName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for NSQ notification, after migrating config",
|
|
||||||
target.NSQAddress: cfg.NSQDAddress.String(),
|
target.NSQAddress: cfg.NSQDAddress.String(),
|
||||||
target.NSQTopic: cfg.Topic,
|
target.NSQTopic: cfg.Topic,
|
||||||
target.NSQTLS: config.FormatBool(cfg.TLS.Enable),
|
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{
|
s[config.NotifyNATSSubSys][natsName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for NATS notification, after migrating config",
|
|
||||||
target.NATSAddress: cfg.Address.String(),
|
target.NATSAddress: cfg.Address.String(),
|
||||||
target.NATSSubject: cfg.Subject,
|
target.NATSSubject: cfg.Subject,
|
||||||
target.NATSUsername: cfg.Username,
|
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{
|
s[config.NotifyMySQLSubSys][sqlName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for MySQL notification, after migrating config",
|
|
||||||
target.MySQLFormat: cfg.Format,
|
target.MySQLFormat: cfg.Format,
|
||||||
target.MySQLDSNString: cfg.DSN,
|
target.MySQLDSNString: cfg.DSN,
|
||||||
target.MySQLTable: cfg.Table,
|
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{
|
s[config.NotifyMQTTSubSys][mqttName] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for MQTT notification, after migrating config",
|
|
||||||
target.MqttBroker: cfg.Broker.String(),
|
target.MqttBroker: cfg.Broker.String(),
|
||||||
target.MqttTopic: cfg.Topic,
|
target.MqttTopic: cfg.Topic,
|
||||||
target.MqttQoS: fmt.Sprintf("%d", cfg.QoS),
|
target.MqttQoS: fmt.Sprintf("%d", cfg.QoS),
|
||||||
|
|
|
@ -34,7 +34,6 @@ func SetPolicyOPAConfig(s config.Config, opaArgs Args) {
|
||||||
}
|
}
|
||||||
s[config.PolicyOPASubSys][config.Default] = config.KVS{
|
s[config.PolicyOPASubSys][config.Default] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for OPA, after migrating config",
|
|
||||||
URL: opaArgs.URL.String(),
|
URL: opaArgs.URL.String(),
|
||||||
AuthToken: opaArgs.AuthToken,
|
AuthToken: opaArgs.AuthToken,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,5 @@ func SetStorageClass(s config.Config, cfg Config) {
|
||||||
ClassStandard: cfg.Standard.String(),
|
ClassStandard: cfg.Standard.String(),
|
||||||
ClassRRS: cfg.RRS.String(),
|
ClassRRS: cfg.RRS.String(),
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for StorageClass, after migrating config",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,6 @@ func SetKMSConfig(s config.Config, cfg KMSConfig) {
|
||||||
KMSVaultKeyVersion: strconv.Itoa(cfg.Vault.Key.Version),
|
KMSVaultKeyVersion: strconv.Itoa(cfg.Vault.Key.Version),
|
||||||
KMSVaultNamespace: cfg.Vault.Namespace,
|
KMSVaultNamespace: cfg.Vault.Namespace,
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for KMS Vault, after migrating config",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ func SetLoggerHTTPAudit(scfg config.Config, k string, args HTTP) {
|
||||||
}
|
}
|
||||||
scfg[config.AuditWebhookSubSys][k] = config.KVS{
|
scfg[config.AuditWebhookSubSys][k] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Webhook Audit logging, after migrating config",
|
|
||||||
Endpoint: args.Endpoint,
|
Endpoint: args.Endpoint,
|
||||||
AuthToken: args.AuthToken,
|
AuthToken: args.AuthToken,
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,6 @@ func SetLoggerHTTP(scfg config.Config, k string, args HTTP) {
|
||||||
|
|
||||||
scfg[config.LoggerWebhookSubSys][k] = config.KVS{
|
scfg[config.LoggerWebhookSubSys][k] = config.KVS{
|
||||||
config.State: config.StateOn,
|
config.State: config.StateOn,
|
||||||
config.Comment: "Settings for Webhook logging, after migrating config",
|
|
||||||
Endpoint: args.Endpoint,
|
Endpoint: args.Endpoint,
|
||||||
AuthToken: args.AuthToken,
|
AuthToken: args.AuthToken,
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,9 @@ func (kvs KVS) String() string {
|
||||||
if k == stateKey && v == stateOn {
|
if k == stateKey && v == stateOn {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if k == commentKey && v == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
s.WriteString(k)
|
s.WriteString(k)
|
||||||
s.WriteString(KvSeparator)
|
s.WriteString(KvSeparator)
|
||||||
spc := hasSpace(v)
|
spc := hasSpace(v)
|
||||||
|
@ -96,7 +99,6 @@ func (t Targets) String() string {
|
||||||
s.WriteString(kv.String())
|
s.WriteString(kv.String())
|
||||||
if (len(t) > 1 || len(targetKV) > 1) && count > 0 {
|
if (len(t) > 1 || len(targetKV) > 1) && count > 0 {
|
||||||
s.WriteString(KvNewline)
|
s.WriteString(KvNewline)
|
||||||
s.WriteString(KvNewline)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue