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:
Anis Elleuch
2017-03-16 00:30:34 +01:00
committed by Harshavardhana
parent cad0d0eb7a
commit ae4361cc45
19 changed files with 1261 additions and 55 deletions

View File

@@ -127,7 +127,7 @@ func initConfig() {
// Config file does not exist, we create it fresh and return upon success.
if !isConfigFileExists() {
if err := newConfig(envs); err != nil {
console.Fatalf("Unable to initialize minio config for the first time. Err: %s.\n", err)
console.Fatalf("Unable to initialize minio config for the first time. Error: %s.\n", err)
}
console.Println("Created minio configuration file successfully at " + getConfigDir())
return
@@ -136,9 +136,14 @@ func initConfig() {
// Migrate any old version of config / state files to newer format.
migrate()
// Validate config file
if err := validateConfig(); err != nil {
console.Fatalf("Cannot validate configuration file. Error: %s\n", err)
}
// Once we have migrated all the old config, now load them.
if err := loadConfig(envs); err != nil {
console.Fatalf("Unable to initialize minio config. Err: %s.\n", err)
console.Fatalf("Unable to initialize minio config. Error: %s.\n", err)
}
}