mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
Generalize loadConfig method to avoid reading from disk (#5819)
As we move to multiple config backends like local disk and etcd, config file should not be read from the disk, instead the quick package should load and verify for duplicate entries.
This commit is contained in:
committed by
Harshavardhana
parent
57b8db2088
commit
638f01f9e4
@@ -136,6 +136,11 @@ func loadFileConfig(filename string, v interface{}) error {
|
||||
if runtime.GOOS == "windows" {
|
||||
fileData = []byte(strings.Replace(string(fileData), "\r\n", "\n", -1))
|
||||
}
|
||||
|
||||
if err = checkDupJSONKeys(string(fileData)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Unmarshal file's content
|
||||
return toUnmarshaller(filepath.Ext(filename))(fileData, v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user