mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 06:26:17 +03:00
config: Check for duplicated entries in all scopes (#3872)
Validate Minio config by checking if there is double json key in any scope level. The returned error contains the json path to the duplicated key.
This commit is contained in:
committed by
Harshavardhana
parent
cad0d0eb7a
commit
ae4361cc45
@@ -16,7 +16,12 @@
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/Sirupsen/logrus"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// consoleLogger - default logger if not other logging is enabled.
|
||||
type consoleLogger struct {
|
||||
@@ -24,6 +29,14 @@ type consoleLogger struct {
|
||||
Level string `json:"level"`
|
||||
}
|
||||
|
||||
func (c *consoleLogger) Validate() error {
|
||||
level := strings.ToLower(c.Level)
|
||||
if level != "error" && level != "fatal" && level != "" {
|
||||
return fmt.Errorf("`%s` level value not recognized", c.Level)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// enable console logger.
|
||||
func enableConsoleLogger() {
|
||||
clogger := serverConfig.Logger.GetConsole()
|
||||
|
||||
Reference in New Issue
Block a user