mirror of
https://github.com/minio/minio.git
synced 2025-11-23 02:57:42 -05:00
Migrate config.json from config-dir to backend (#6195)
This PR is the first set of changes to move the config to the backend, the changes use the existing `config.json` allows it to be migrated such that we can save it in on backend disks. In future releases, we will slowly migrate out of the current architecture. Fixes #6182
This commit is contained in:
committed by
Nitish Tiwari
parent
380524ae27
commit
0e02328c98
@@ -153,9 +153,9 @@ func (d config) DeepDiff(c Config) ([]structs.Field, error) {
|
||||
return fields, nil
|
||||
}
|
||||
|
||||
// checkData - checks the validity of config data. Data should be of
|
||||
// CheckData - checks the validity of config data. Data should be of
|
||||
// type struct and contain a string type field called "Version".
|
||||
func checkData(data interface{}) error {
|
||||
func CheckData(data interface{}) error {
|
||||
if !structs.IsStruct(data) {
|
||||
return fmt.Errorf("interface must be struct type")
|
||||
}
|
||||
@@ -211,7 +211,7 @@ func LoadConfig(filename string, clnt *etcd.Client, data interface{}) (qc Config
|
||||
|
||||
// SaveConfig - saves given configuration data into given file as JSON.
|
||||
func SaveConfig(data interface{}, filename string, clnt *etcd.Client) (err error) {
|
||||
if err = checkData(data); err != nil {
|
||||
if err = CheckData(data); err != nil {
|
||||
return err
|
||||
}
|
||||
var qc Config
|
||||
@@ -225,7 +225,7 @@ func SaveConfig(data interface{}, filename string, clnt *etcd.Client) (err error
|
||||
// NewConfig loads config from etcd client if provided, otherwise loads from a local filename.
|
||||
// fails when all else fails.
|
||||
func NewConfig(data interface{}, clnt *etcd.Client) (cfg Config, err error) {
|
||||
if err := checkData(data); err != nil {
|
||||
if err := CheckData(data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user