mirror of
https://github.com/minio/minio.git
synced 2025-11-25 20:16:10 -05:00
Fix review comments and new changes in config (#8515)
- Migrate and save only settings which are enabled - Rename logger_http to logger_webhook and logger_http_audit to audit_webhook - No more pretty printing comments, comment is a key=value pair now. - Avoid quotes on values which do not have space in them - `state="on"` is implicit for all SetConfigKV unless specified explicitly as `state="off"` - Disabled IAM users should be disabled always
This commit is contained in:
@@ -25,14 +25,13 @@ const (
|
||||
|
||||
// SetLoggerHTTPAudit - helper for migrating older config to newer KV format.
|
||||
func SetLoggerHTTPAudit(scfg config.Config, k string, args HTTP) {
|
||||
scfg[config.LoggerHTTPAuditSubSys][k] = config.KVS{
|
||||
config.State: func() string {
|
||||
if args.Enabled {
|
||||
return config.StateOn
|
||||
}
|
||||
return config.StateOff
|
||||
}(),
|
||||
config.Comment: "Settings for HTTP Audit logging, after migrating config",
|
||||
if !args.Enabled {
|
||||
// Do not enable audit targets, if not enabled
|
||||
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,
|
||||
}
|
||||
@@ -40,14 +39,14 @@ func SetLoggerHTTPAudit(scfg config.Config, k string, args HTTP) {
|
||||
|
||||
// SetLoggerHTTP helper for migrating older config to newer KV format.
|
||||
func SetLoggerHTTP(scfg config.Config, k string, args HTTP) {
|
||||
scfg[config.LoggerHTTPSubSys][k] = config.KVS{
|
||||
config.State: func() string {
|
||||
if args.Enabled {
|
||||
return config.StateOn
|
||||
}
|
||||
return config.StateOff
|
||||
}(),
|
||||
config.Comment: "Settings for HTTP logging, after migrating config",
|
||||
if !args.Enabled {
|
||||
// Do not enable logger http targets, if not enabled
|
||||
return
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user