Final changes to config sub-system (#8600)

- Introduces changes such as certain types of
  errors that can be ignored or which need to 
  go into safe mode.
- Update help text as per the review
This commit is contained in:
Harshavardhana
2019-12-04 15:32:37 -08:00
committed by kannappanr
parent 794eb54da8
commit c9940d8c3f
65 changed files with 605 additions and 1033 deletions

View File

@@ -26,78 +26,78 @@ var (
HelpAMQP = config.HelpKVS{
config.HelpKV{
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`",
Type: "url",
},
config.HelpKV{
Key: target.AmqpExchange,
Description: "Name of the AMQP exchange",
Description: "name of the AMQP exchange",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.AmqpExchangeType,
Description: "Kind of AMQP exchange type",
Description: "kind of AMQP exchange type",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.AmqpRoutingKey,
Description: "Routing key for publishing",
Description: "routing key for publishing",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.AmqpMandatory,
Description: "Set this to 'on' for server to return an unroutable message with a Return method. If this flag is 'off', the server silently drops the message",
Description: "set this to 'on' for server to return an unroutable message with a Return method. If this flag is 'off', the server silently drops the message",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.AmqpDurable,
Description: "Set this to 'on' for queue to survive broker restarts",
Description: "set this to 'on' for queue to survive broker restarts",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.AmqpNoWait,
Description: "When no_wait is 'on', declare without waiting for a confirmation from the server",
Description: "when no_wait is 'on', declare without waiting for a confirmation from the server",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.AmqpInternal,
Description: "Set this to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges",
Description: "set this to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.AmqpAutoDeleted,
Description: "Set this to 'on' for queue that has had at least one consumer is deleted when last consumer unsubscribes",
Description: "set this to 'on' for queue that has had at least one consumer is deleted when last consumer unsubscribes",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.AmqpDeliveryMode,
Description: "Delivery queue implementation use non-persistent (1) or persistent (2)",
Description: "delivery queue implementation use non-persistent (1) or persistent (2)",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.AmqpQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.AmqpQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the AMQP target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -106,66 +106,66 @@ var (
HelpKafka = config.HelpKVS{
config.HelpKV{
Key: target.KafkaBrokers,
Description: "Comma separated list of Kafka broker addresses",
Description: "comma separated list of Kafka broker addresses",
Type: "csv",
},
config.HelpKV{
Key: target.KafkaTopic,
Description: "The Kafka topic for a given message",
Description: "Kafka topic used for bucket notifications",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.KafkaSASLUsername,
Description: "Username for SASL/PLAIN or SASL/SCRAM authentication",
Description: "username for SASL/PLAIN or SASL/SCRAM authentication",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.KafkaSASLPassword,
Description: "Password for SASL/PLAIN or SASL/SCRAM authentication",
Description: "password for SASL/PLAIN or SASL/SCRAM authentication",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.KafkaTLSClientAuth,
Description: "ClientAuth determines the Kafka server's policy for TLS client auth",
Description: "clientAuth determines the Kafka server's policy for TLS client auth",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.KafkaSASL,
Description: "Set this to 'on' to enable SASL authentication",
Description: "set this to 'on' to enable SASL authentication",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.KafkaTLS,
Description: "Set this to 'on' to enable TLS",
Description: "set this to 'on' to enable TLS",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.KafkaTLSSkipVerify,
Description: "Set this to 'on' to disable client verification of server certificate chain",
Description: "set this to 'on' to disable client verification of server certificate chain",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.KafkaQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.KafkaQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the Kafka target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -174,59 +174,59 @@ var (
HelpMQTT = config.HelpKVS{
config.HelpKV{
Key: target.MqttBroker,
Description: "MQTT server endpoint, e.g. `tcp://localhost:1883`",
Description: "MQTT server endpoint e.g. `tcp://localhost:1883`",
Type: "uri",
},
config.HelpKV{
Key: target.MqttTopic,
Description: "Name of the MQTT topic to publish on, e.g. `minio`",
Description: "name of the MQTT topic to publish on, e.g. `minio`",
Type: "string",
},
config.HelpKV{
Key: target.MqttUsername,
Description: "Username to connect to the MQTT server",
Description: "username to connect to the MQTT server",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.MqttPassword,
Description: "Password to connect to the MQTT server",
Description: "password to connect to the MQTT server",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.MqttQoS,
Description: "Set the Quality of Service Level for MQTT endpoint",
Description: "set the Quality of Service Level for MQTT endpoint",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.MqttKeepAliveInterval,
Description: "Keep alive interval for MQTT connections",
Description: "keep alive interval for MQTT connections",
Optional: true,
Type: "duration",
},
config.HelpKV{
Key: target.MqttReconnectInterval,
Description: "Reconnect interval for MQTT connections",
Description: "reconnect interval for MQTT connections",
Optional: true,
Type: "duration",
},
config.HelpKV{
Key: target.MqttQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.MqttQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the MQTT target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -235,34 +235,34 @@ var (
HelpES = config.HelpKVS{
config.HelpKV{
Key: target.ElasticURL,
Description: "The Elasticsearch server's address, with optional authentication info",
Description: "Elasticsearch server's address, with optional authentication info",
Type: "url",
},
config.HelpKV{
Key: target.ElasticFormat,
Description: "Either `namespace` or `access`, defaults to 'namespace'",
Description: "set this to `namespace` or `access`, defaults to 'namespace'",
Type: "namespace*|access",
},
config.HelpKV{
Key: target.ElasticIndex,
Description: "The name of an Elasticsearch index in which MinIO will store document",
Description: "the name of an Elasticsearch index in which MinIO will store document",
Type: "string",
},
config.HelpKV{
Key: target.ElasticQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.ElasticQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the Elasticsearch target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -271,30 +271,30 @@ var (
HelpWebhook = config.HelpKVS{
config.HelpKV{
Key: target.WebhookEndpoint,
Description: "Webhook server endpoint eg: http://localhost:8080/minio/events",
Description: "webhook server endpoint e.g. http://localhost:8080/minio/events",
Type: "url",
},
config.HelpKV{
Key: target.WebhookAuthToken,
Description: "Authorization token used for webhook server endpoint",
Description: "authorization token used for webhook server endpoint",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.WebhookQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.WebhookQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the Webhook target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -303,40 +303,40 @@ var (
HelpRedis = config.HelpKVS{
config.HelpKV{
Key: target.RedisAddress,
Description: "The Redis server's address. For example: `localhost:6379`",
Description: "Redis server's address. For example: `localhost:6379`",
Type: "address",
},
config.HelpKV{
Key: target.RedisFormat,
Description: "Specify how data is populated, a hash is used in case of `namespace` format and a list in case of `access` format, defaults to 'namespace'",
Type: "namespace|access",
Description: "specifies how data is populated, a hash is used in case of `namespace` format and a list in case of `access` format, defaults to 'namespace'",
Type: "namespace*|access",
},
config.HelpKV{
Key: target.RedisKey,
Description: "The name of the Redis key under which events are stored",
Description: "name of the Redis key under which events are stored",
Type: "string",
},
config.HelpKV{
Key: target.RedisPassword,
Description: "The Redis server's password",
Description: "Redis server's password",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.RedisQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.RedisQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the Redis target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -345,64 +345,64 @@ var (
HelpPostgres = config.HelpKVS{
config.HelpKV{
Key: target.PostgresConnectionString,
Description: "Connection string parameters for the PostgreSQL server",
Description: "connection string parameters for the PostgreSQL server",
Type: "string",
},
config.HelpKV{
Key: target.PostgresFormat,
Description: "Specify how data is populated, `namespace` format and `access` format, defaults to 'namespace'",
Type: "namespace|access",
Description: "specifies how data is populated, `namespace` format and `access` format, defaults to 'namespace'",
Type: "namespace*|access",
},
config.HelpKV{
Key: target.PostgresTable,
Description: "Table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up",
Description: "table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up",
Type: "string",
},
config.HelpKV{
Key: target.PostgresHost,
Description: "Host name of the PostgreSQL server. Defaults to `localhost`. IPv6 host should be enclosed with `[` and `]`",
Description: "host name of the PostgreSQL server. Defaults to `localhost`. IPv6 host should be enclosed with `[` and `]`",
Optional: true,
Type: "hostname",
},
config.HelpKV{
Key: target.PostgresPort,
Description: "Port on which to connect to PostgreSQL server, defaults to `5432`",
Description: "port on which to connect to PostgreSQL server, defaults to `5432`",
Optional: true,
Type: "port",
},
config.HelpKV{
Key: target.PostgresUsername,
Description: "Database username, defaults to user running the MinIO process if not specified",
Description: "database username, defaults to user running the MinIO process if not specified",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.PostgresPassword,
Description: "Database password",
Description: "database password",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.PostgresDatabase,
Description: "Postgres Database name",
Description: "postgres Database name",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.PostgresQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.PostgresQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the Postgres target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -411,64 +411,64 @@ var (
HelpMySQL = config.HelpKVS{
config.HelpKV{
Key: target.MySQLDSNString,
Description: "Data-Source-Name connection string for the MySQL server",
Description: "data source name connection string for the MySQL server",
Type: "string",
},
config.HelpKV{
Key: target.MySQLTable,
Description: "Table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up",
Description: "table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up",
Type: "string",
},
config.HelpKV{
Key: target.MySQLFormat,
Description: "Specify how data is populated, `namespace` format and `access` format, defaults to 'namespace'",
Type: "namespace|access",
Description: "specifies how data is populated, `namespace` format and `access` format, defaults to 'namespace'",
Type: "namespace*|access",
},
config.HelpKV{
Key: target.MySQLHost,
Description: "Host name of the MySQL server (used only if `dsnString` is empty)",
Description: "host name of the MySQL server (used only if `dsnString` is empty)",
Optional: true,
Type: "hostname",
},
config.HelpKV{
Key: target.MySQLPort,
Description: "Port on which to connect to the MySQL server (used only if `dsn_string` is empty)",
Description: "port on which to connect to the MySQL server (used only if `dsn_string` is empty)",
Optional: true,
Type: "port",
},
config.HelpKV{
Key: target.MySQLUsername,
Description: "Database user-name (used only if `dsnString` is empty)",
Description: "database user-name (used only if `dsnString` is empty)",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.MySQLPassword,
Description: "Database password (used only if `dsnString` is empty)",
Description: "database password (used only if `dsnString` is empty)",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.MySQLDatabase,
Description: "Database name (used only if `dsnString` is empty)",
Description: "database name (used only if `dsnString` is empty)",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.MySQLQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.MySQLQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the MySQL target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -477,7 +477,7 @@ var (
HelpNATS = config.HelpKVS{
config.HelpKV{
Key: target.NATSAddress,
Description: "NATS server address eg: '0.0.0.0:4222'",
Description: "NATS server address e.g. '0.0.0.0:4222'",
Type: "address",
},
config.HelpKV{
@@ -487,91 +487,91 @@ var (
},
config.HelpKV{
Key: target.NATSUsername,
Description: "Username to be used when connecting to the server",
Description: "username to be used when connecting to the server",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSPassword,
Description: "Password to be used when connecting to a server",
Description: "password to be used when connecting to a server",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSToken,
Description: "Token to be used when connecting to a server",
Description: "token to be used when connecting to a server",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSSecure,
Description: "Set this to 'on', enables TLS secure connections that skip server verification (not recommended)",
Description: "set this to 'on', enables TLS secure connections that skip server verification (not recommended)",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSPingInterval,
Description: "Client ping commands interval to the server, disabled by default",
Description: "client ping commands interval to the server, disabled by default",
Optional: true,
Type: "duration",
},
config.HelpKV{
Key: target.NATSStreaming,
Description: "Set this to 'on', to use streaming NATS server",
Description: "set this to 'on', to use streaming NATS server",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSStreamingAsync,
Description: "Set this to 'on', to enable asynchronous publish, process the ACK or error state",
Description: "set this to 'on', to enable asynchronous publish, process the ACK or error state",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NATSStreamingMaxPubAcksInFlight,
Description: "Specifies how many messages can be published without getting ACKs back from NATS streaming server",
Description: "specifies how many messages can be published without getting ACKs back from NATS streaming server",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.NATSStreamingClusterID,
Description: "Unique ID for the NATS streaming cluster",
Description: "unique ID for the NATS streaming cluster",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: target.NATSQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.NATSCertAuthority,
Description: "Certificate chain of the target NATS server if self signed certs were used",
Description: "certificate chain of the target NATS server if self signed certs were used",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSClientCert,
Description: "TLS Cert used to authenticate against NATS configured to require client certificates",
Description: "TLS Cert used for NATS configured to require client certificates",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: target.NATSClientKey,
Description: "TLS Key used to authenticate against NATS configured to require client certificates",
Description: "TLS Key used for NATS configured to require client certificates",
Optional: true,
Type: "string",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the NATS target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},
@@ -580,7 +580,7 @@ var (
HelpNSQ = config.HelpKVS{
config.HelpKV{
Key: target.NSQAddress,
Description: "NSQ server address eg: '127.0.0.1:4150'",
Description: "NSQ server address e.g. '127.0.0.1:4150'",
Type: "address",
},
config.HelpKV{
@@ -590,31 +590,31 @@ var (
},
config.HelpKV{
Key: target.NSQTLS,
Description: "Set this to 'on', to enable TLS negotiation",
Description: "set this to 'on', to enable TLS negotiation",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NSQTLSSkipVerify,
Description: "Set this to 'on', to disable client verification of server certificates",
Description: "set this to 'on', to disable client verification of server certificates",
Optional: true,
Type: "on|off",
},
config.HelpKV{
Key: target.NSQQueueDir,
Description: "Local directory where events are stored eg: '/home/events'",
Description: "local directory where events are stored e.g. '/home/events'",
Optional: true,
Type: "path",
},
config.HelpKV{
Key: target.NSQQueueLimit,
Description: "Enable persistent event store queue limit, defaults to '10000'",
Description: "enable persistent event store queue limit, defaults to '10000'",
Optional: true,
Type: "number",
},
config.HelpKV{
Key: config.Comment,
Description: "A comment to describe the NSQ target setting",
Description: config.DefaultComment,
Optional: true,
Type: "sentence",
},

View File

@@ -21,8 +21,8 @@ func SetNotifyKafka(s config.Config, kName string, cfg target.KafkaArgs) error {
s[config.NotifyKafkaSubSys][kName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.KafkaBrokers,
@@ -86,8 +86,8 @@ func SetNotifyAMQP(s config.Config, amqpName string, cfg target.AMQPArgs) error
s[config.NotifyAMQPSubSys][amqpName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.AmqpURL,
@@ -154,8 +154,8 @@ func SetNotifyES(s config.Config, esName string, cfg target.ElasticsearchArgs) e
s[config.NotifyESSubSys][esName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.ElasticFormat,
@@ -194,8 +194,8 @@ func SetNotifyRedis(s config.Config, redisName string, cfg target.RedisArgs) err
s[config.NotifyRedisSubSys][redisName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.RedisFormat,
@@ -238,8 +238,8 @@ func SetNotifyWebhook(s config.Config, whName string, cfg target.WebhookArgs) er
s[config.NotifyWebhookSubSys][whName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.WebhookEndpoint,
@@ -274,8 +274,8 @@ func SetNotifyPostgres(s config.Config, psqName string, cfg target.PostgreSQLArg
s[config.NotifyPostgresSubSys][psqName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.PostgresFormat,
@@ -334,8 +334,8 @@ func SetNotifyNSQ(s config.Config, nsqName string, cfg target.NSQArgs) error {
s[config.NotifyNSQSubSys][nsqName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.NSQAddress,
@@ -378,8 +378,8 @@ func SetNotifyNATS(s config.Config, natsName string, cfg target.NATSArgs) error
s[config.NotifyNATSSubSys][natsName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.NATSAddress,
@@ -433,9 +433,9 @@ func SetNotifyNATS(s config.Config, natsName string, cfg target.NATSArgs) error
Key: target.NATSStreaming,
Value: func() string {
if cfg.Streaming.Enable {
return config.StateOn
return config.EnableOn
}
return config.StateOff
return config.EnableOff
}(),
},
config.KV{
@@ -467,8 +467,8 @@ func SetNotifyMySQL(s config.Config, sqlName string, cfg target.MySQLArgs) error
s[config.NotifyMySQLSubSys][sqlName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.MySQLFormat,
@@ -527,8 +527,8 @@ func SetNotifyMQTT(s config.Config, mqttName string, cfg target.MQTTArgs) error
s[config.NotifyMQTTSubSys][mqttName] = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOn,
Key: config.Enable,
Value: config.EnableOn,
},
config.KV{
Key: target.MqttBroker,

View File

@@ -341,8 +341,8 @@ func mergeTargets(cfgTargets map[string]config.KVS, envname string, defaultKVS c
var (
DefaultKafkaKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.KafkaTopic,
@@ -366,15 +366,15 @@ var (
},
config.KV{
Key: target.KafkaSASL,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.KafkaTLS,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.KafkaTLSSkipVerify,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.KafkaQueueLimit,
@@ -390,12 +390,12 @@ var (
// GetNotifyKafka - returns a map of registered notification 'kafka' targets
func GetNotifyKafka(kafkaKVS map[string]config.KVS) (map[string]target.KafkaArgs, error) {
kafkaTargets := make(map[string]target.KafkaArgs)
for k, kv := range mergeTargets(kafkaKVS, target.EnvKafkaState, DefaultKafkaKVS) {
stateEnv := target.EnvKafkaState
for k, kv := range mergeTargets(kafkaKVS, target.EnvKafkaEnable, DefaultKafkaKVS) {
enableEnv := target.EnvKafkaEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -409,7 +409,7 @@ func GetNotifyKafka(kafkaKVS map[string]config.KVS) (map[string]target.KafkaArgs
}
kafkaBrokers := env.Get(brokersEnv, kv.Get(target.KafkaBrokers))
if len(kafkaBrokers) == 0 {
return nil, config.Error("kafka 'brokers' cannot be empty")
return nil, config.Errorf(config.SafeModeKind, "kafka 'brokers' cannot be empty")
}
for _, s := range strings.Split(kafkaBrokers, config.ValueSeparator) {
var host *xnet.Host
@@ -467,8 +467,8 @@ func GetNotifyKafka(kafkaKVS map[string]config.KVS) (map[string]target.KafkaArgs
if k != config.Default {
tlsSkipVerifyEnv = tlsSkipVerifyEnv + config.Default + k
}
kafkaArgs.TLS.Enable = env.Get(tlsEnableEnv, kv.Get(target.KafkaTLS)) == config.StateOn
kafkaArgs.TLS.SkipVerify = env.Get(tlsSkipVerifyEnv, kv.Get(target.KafkaTLSSkipVerify)) == config.StateOn
kafkaArgs.TLS.Enable = env.Get(tlsEnableEnv, kv.Get(target.KafkaTLS)) == config.EnableOn
kafkaArgs.TLS.SkipVerify = env.Get(tlsSkipVerifyEnv, kv.Get(target.KafkaTLSSkipVerify)) == config.EnableOn
kafkaArgs.TLS.ClientAuth = tls.ClientAuthType(clientAuth)
saslEnableEnv := target.EnvKafkaSASLEnable
@@ -483,7 +483,7 @@ func GetNotifyKafka(kafkaKVS map[string]config.KVS) (map[string]target.KafkaArgs
if k != config.Default {
saslPasswordEnv = saslPasswordEnv + config.Default + k
}
kafkaArgs.SASL.Enable = env.Get(saslEnableEnv, kv.Get(target.KafkaSASL)) == config.StateOn
kafkaArgs.SASL.Enable = env.Get(saslEnableEnv, kv.Get(target.KafkaSASL)) == config.EnableOn
kafkaArgs.SASL.User = env.Get(saslUsernameEnv, kv.Get(target.KafkaSASLUsername))
kafkaArgs.SASL.Password = env.Get(saslPasswordEnv, kv.Get(target.KafkaSASLPassword))
@@ -501,8 +501,8 @@ func GetNotifyKafka(kafkaKVS map[string]config.KVS) (map[string]target.KafkaArgs
var (
DefaultMQTTKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.MqttBroker,
@@ -546,13 +546,13 @@ var (
// GetNotifyMQTT - returns a map of registered notification 'mqtt' targets
func GetNotifyMQTT(mqttKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[string]target.MQTTArgs, error) {
mqttTargets := make(map[string]target.MQTTArgs)
for k, kv := range mergeTargets(mqttKVS, target.EnvMQTTState, DefaultMQTTKVS) {
stateEnv := target.EnvMQTTState
for k, kv := range mergeTargets(mqttKVS, target.EnvMQTTEnable, DefaultMQTTKVS) {
enableEnv := target.EnvMQTTEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -656,8 +656,8 @@ func GetNotifyMQTT(mqttKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[s
var (
DefaultMySQLKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.MySQLFormat,
@@ -705,13 +705,13 @@ var (
// GetNotifyMySQL - returns a map of registered notification 'mysql' targets
func GetNotifyMySQL(mysqlKVS map[string]config.KVS) (map[string]target.MySQLArgs, error) {
mysqlTargets := make(map[string]target.MySQLArgs)
for k, kv := range mergeTargets(mysqlKVS, target.EnvMySQLState, DefaultMySQLKVS) {
stateEnv := target.EnvMySQLState
for k, kv := range mergeTargets(mysqlKVS, target.EnvMySQLEnable, DefaultMySQLKVS) {
enableEnv := target.EnvMySQLEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -795,8 +795,8 @@ func GetNotifyMySQL(mysqlKVS map[string]config.KVS) (map[string]target.MySQLArgs
var (
DefaultNATSKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.NATSAddress,
@@ -832,7 +832,7 @@ var (
},
config.KV{
Key: target.NATSSecure,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.NATSPingInterval,
@@ -840,11 +840,11 @@ var (
},
config.KV{
Key: target.NATSStreaming,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.NATSStreamingAsync,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.NATSStreamingMaxPubAcksInFlight,
@@ -868,13 +868,13 @@ var (
// GetNotifyNATS - returns a map of registered notification 'nats' targets
func GetNotifyNATS(natsKVS map[string]config.KVS) (map[string]target.NATSArgs, error) {
natsTargets := make(map[string]target.NATSArgs)
for k, kv := range mergeTargets(natsKVS, target.EnvNATSState, DefaultNATSKVS) {
stateEnv := target.EnvNATSState
for k, kv := range mergeTargets(natsKVS, target.EnvNATSEnable, DefaultNATSKVS) {
enableEnv := target.EnvNATSEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -967,7 +967,7 @@ func GetNotifyNATS(natsKVS map[string]config.KVS) (map[string]target.NATSArgs, e
ClientCert: env.Get(clientCertEnv, kv.Get(target.NATSClientCert)),
ClientKey: env.Get(clientKeyEnv, kv.Get(target.NATSClientKey)),
Token: env.Get(tokenEnv, kv.Get(target.NATSToken)),
Secure: env.Get(secureEnv, kv.Get(target.NATSSecure)) == config.StateOn,
Secure: env.Get(secureEnv, kv.Get(target.NATSSecure)) == config.EnableOn,
PingInterval: pingInterval,
QueueDir: env.Get(queueDirEnv, kv.Get(target.NATSQueueDir)),
QueueLimit: queueLimit,
@@ -978,7 +978,7 @@ func GetNotifyNATS(natsKVS map[string]config.KVS) (map[string]target.NATSArgs, e
streamingEnableEnv = streamingEnableEnv + config.Default + k
}
streamingEnabled := env.Get(streamingEnableEnv, kv.Get(target.NATSStreaming)) == config.StateOn
streamingEnabled := env.Get(streamingEnableEnv, kv.Get(target.NATSStreaming)) == config.EnableOn
if streamingEnabled {
asyncEnv := target.EnvNATSStreamingAsync
if k != config.Default {
@@ -999,7 +999,7 @@ func GetNotifyNATS(natsKVS map[string]config.KVS) (map[string]target.NATSArgs, e
}
natsArgs.Streaming.Enable = streamingEnabled
natsArgs.Streaming.ClusterID = env.Get(clusterIDEnv, kv.Get(target.NATSStreamingClusterID))
natsArgs.Streaming.Async = env.Get(asyncEnv, kv.Get(target.NATSStreamingAsync)) == config.StateOn
natsArgs.Streaming.Async = env.Get(asyncEnv, kv.Get(target.NATSStreamingAsync)) == config.EnableOn
natsArgs.Streaming.MaxPubAcksInflight = maxPubAcksInflight
}
@@ -1016,8 +1016,8 @@ func GetNotifyNATS(natsKVS map[string]config.KVS) (map[string]target.NATSArgs, e
var (
DefaultNSQKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.NSQAddress,
@@ -1029,11 +1029,11 @@ var (
},
config.KV{
Key: target.NSQTLS,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.NSQTLSSkipVerify,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.NSQQueueDir,
@@ -1049,13 +1049,13 @@ var (
// GetNotifyNSQ - returns a map of registered notification 'nsq' targets
func GetNotifyNSQ(nsqKVS map[string]config.KVS) (map[string]target.NSQArgs, error) {
nsqTargets := make(map[string]target.NSQArgs)
for k, kv := range mergeTargets(nsqKVS, target.EnvNSQState, DefaultNSQKVS) {
stateEnv := target.EnvNSQState
for k, kv := range mergeTargets(nsqKVS, target.EnvNSQEnable, DefaultNSQKVS) {
enableEnv := target.EnvNSQEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -1105,8 +1105,8 @@ func GetNotifyNSQ(nsqKVS map[string]config.KVS) (map[string]target.NSQArgs, erro
QueueDir: env.Get(queueDirEnv, kv.Get(target.NSQQueueDir)),
QueueLimit: queueLimit,
}
nsqArgs.TLS.Enable = env.Get(tlsEnableEnv, kv.Get(target.NSQTLS)) == config.StateOn
nsqArgs.TLS.SkipVerify = env.Get(tlsSkipVerifyEnv, kv.Get(target.NSQTLSSkipVerify)) == config.StateOn
nsqArgs.TLS.Enable = env.Get(tlsEnableEnv, kv.Get(target.NSQTLS)) == config.EnableOn
nsqArgs.TLS.SkipVerify = env.Get(tlsSkipVerifyEnv, kv.Get(target.NSQTLSSkipVerify)) == config.EnableOn
if err = nsqArgs.Validate(); err != nil {
return nil, err
@@ -1121,8 +1121,8 @@ func GetNotifyNSQ(nsqKVS map[string]config.KVS) (map[string]target.NSQArgs, erro
var (
DefaultPostgresKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.PostgresFormat,
@@ -1170,13 +1170,13 @@ var (
// GetNotifyPostgres - returns a map of registered notification 'postgres' targets
func GetNotifyPostgres(postgresKVS map[string]config.KVS) (map[string]target.PostgreSQLArgs, error) {
psqlTargets := make(map[string]target.PostgreSQLArgs)
for k, kv := range mergeTargets(postgresKVS, target.EnvPostgresState, DefaultPostgresKVS) {
stateEnv := target.EnvPostgresState
for k, kv := range mergeTargets(postgresKVS, target.EnvPostgresEnable, DefaultPostgresKVS) {
enableEnv := target.EnvPostgresEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -1270,8 +1270,8 @@ func GetNotifyPostgres(postgresKVS map[string]config.KVS) (map[string]target.Pos
var (
DefaultRedisKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.RedisFormat,
@@ -1303,13 +1303,13 @@ var (
// GetNotifyRedis - returns a map of registered notification 'redis' targets
func GetNotifyRedis(redisKVS map[string]config.KVS) (map[string]target.RedisArgs, error) {
redisTargets := make(map[string]target.RedisArgs)
for k, kv := range mergeTargets(redisKVS, target.EnvRedisState, DefaultRedisKVS) {
stateEnv := target.EnvRedisState
for k, kv := range mergeTargets(redisKVS, target.EnvRedisEnable, DefaultRedisKVS) {
enableEnv := target.EnvRedisEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -1370,8 +1370,8 @@ func GetNotifyRedis(redisKVS map[string]config.KVS) (map[string]target.RedisArgs
var (
DefaultWebhookKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.WebhookEndpoint,
@@ -1395,12 +1395,12 @@ var (
// GetNotifyWebhook - returns a map of registered notification 'webhook' targets
func GetNotifyWebhook(webhookKVS map[string]config.KVS, rootCAs *x509.CertPool) (map[string]target.WebhookArgs, error) {
webhookTargets := make(map[string]target.WebhookArgs)
for k, kv := range mergeTargets(webhookKVS, target.EnvWebhookState, DefaultWebhookKVS) {
stateEnv := target.EnvWebhookState
for k, kv := range mergeTargets(webhookKVS, target.EnvWebhookEnable, DefaultWebhookKVS) {
enableEnv := target.EnvWebhookEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -1452,8 +1452,8 @@ func GetNotifyWebhook(webhookKVS map[string]config.KVS, rootCAs *x509.CertPool)
var (
DefaultESKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.ElasticURL,
@@ -1481,12 +1481,12 @@ var (
// GetNotifyES - returns a map of registered notification 'elasticsearch' targets
func GetNotifyES(esKVS map[string]config.KVS) (map[string]target.ElasticsearchArgs, error) {
esTargets := make(map[string]target.ElasticsearchArgs)
for k, kv := range mergeTargets(esKVS, target.EnvElasticState, DefaultESKVS) {
stateEnv := target.EnvElasticState
for k, kv := range mergeTargets(esKVS, target.EnvElasticEnable, DefaultESKVS) {
enableEnv := target.EnvElasticEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -1549,8 +1549,8 @@ func GetNotifyES(esKVS map[string]config.KVS) (map[string]target.ElasticsearchAr
var (
DefaultAMQPKVS = config.KVS{
config.KV{
Key: config.State,
Value: config.StateOff,
Key: config.Enable,
Value: config.EnableOff,
},
config.KV{
Key: target.AmqpURL,
@@ -1570,23 +1570,23 @@ var (
},
config.KV{
Key: target.AmqpMandatory,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.AmqpDurable,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.AmqpNoWait,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.AmqpInternal,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.AmqpAutoDeleted,
Value: config.StateOff,
Value: config.EnableOff,
},
config.KV{
Key: target.AmqpDeliveryMode,
@@ -1606,12 +1606,12 @@ var (
// GetNotifyAMQP - returns a map of registered notification 'amqp' targets
func GetNotifyAMQP(amqpKVS map[string]config.KVS) (map[string]target.AMQPArgs, error) {
amqpTargets := make(map[string]target.AMQPArgs)
for k, kv := range mergeTargets(amqpKVS, target.EnvAMQPState, DefaultAMQPKVS) {
stateEnv := target.EnvAMQPState
for k, kv := range mergeTargets(amqpKVS, target.EnvAMQPEnable, DefaultAMQPKVS) {
enableEnv := target.EnvAMQPEnable
if k != config.Default {
stateEnv = stateEnv + config.Default + k
enableEnv = enableEnv + config.Default + k
}
enabled, err := config.ParseBool(env.Get(stateEnv, kv.Get(config.State)))
enabled, err := config.ParseBool(env.Get(enableEnv, kv.Get(config.Enable)))
if err != nil {
return nil, err
}
@@ -1689,12 +1689,12 @@ func GetNotifyAMQP(amqpKVS map[string]config.KVS) (map[string]target.AMQPArgs, e
RoutingKey: env.Get(routingKeyEnv, kv.Get(target.AmqpRoutingKey)),
ExchangeType: env.Get(exchangeTypeEnv, kv.Get(target.AmqpExchangeType)),
DeliveryMode: uint8(deliveryMode),
Mandatory: env.Get(mandatoryEnv, kv.Get(target.AmqpMandatory)) == config.StateOn,
Immediate: env.Get(immediateEnv, kv.Get(target.AmqpImmediate)) == config.StateOn,
Durable: env.Get(durableEnv, kv.Get(target.AmqpDurable)) == config.StateOn,
Internal: env.Get(internalEnv, kv.Get(target.AmqpInternal)) == config.StateOn,
NoWait: env.Get(noWaitEnv, kv.Get(target.AmqpNoWait)) == config.StateOn,
AutoDeleted: env.Get(autoDeletedEnv, kv.Get(target.AmqpAutoDeleted)) == config.StateOn,
Mandatory: env.Get(mandatoryEnv, kv.Get(target.AmqpMandatory)) == config.EnableOn,
Immediate: env.Get(immediateEnv, kv.Get(target.AmqpImmediate)) == config.EnableOn,
Durable: env.Get(durableEnv, kv.Get(target.AmqpDurable)) == config.EnableOn,
Internal: env.Get(internalEnv, kv.Get(target.AmqpInternal)) == config.EnableOn,
NoWait: env.Get(noWaitEnv, kv.Get(target.AmqpNoWait)) == config.EnableOn,
AutoDeleted: env.Get(autoDeletedEnv, kv.Get(target.AmqpAutoDeleted)) == config.EnableOn,
QueueDir: env.Get(queueDirEnv, kv.Get(target.AmqpQueueDir)),
QueueLimit: queueLimit,
}