mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Order all keys in config (#8541)
New changes - return default values when sub-sys is not configured. - state is hidden parameter now - remove worm mode to be saved in config
This commit is contained in:
@@ -156,7 +156,7 @@ func (a adminAPIHandlers) SetConfigKVHandler(w http.ResponseWriter, r *http.Requ
|
||||
if scanner.Text() == "" || strings.HasPrefix(scanner.Text(), config.KvComment) {
|
||||
continue
|
||||
}
|
||||
if err = cfg.SetKVS(scanner.Text()); err != nil {
|
||||
if err = cfg.SetKVS(scanner.Text(), defaultKVS()); err != nil {
|
||||
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
|
||||
return
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (a adminAPIHandlers) GetConfigKVHandler(w http.ResponseWriter, r *http.Requ
|
||||
var buf = &bytes.Buffer{}
|
||||
key := vars["key"]
|
||||
if key != "" {
|
||||
kvs, err := cfg.GetKVS(key)
|
||||
kvs, err := cfg.GetKVS(key, defaultKVS())
|
||||
if err != nil {
|
||||
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
|
||||
return
|
||||
@@ -311,11 +311,12 @@ func (a adminAPIHandlers) RestoreConfigHistoryKVHandler(w http.ResponseWriter, r
|
||||
oldCfg := cfg.Clone()
|
||||
scanner := bufio.NewScanner(bytes.NewReader(kvBytes))
|
||||
for scanner.Scan() {
|
||||
// Skip any empty lines
|
||||
if scanner.Text() == "" {
|
||||
// Skip any empty lines, or comment like characters
|
||||
if scanner.Text() == "" || strings.HasPrefix(scanner.Text(), config.KvComment) {
|
||||
continue
|
||||
}
|
||||
if err = cfg.SetKVS(scanner.Text()); err != nil {
|
||||
|
||||
if err = cfg.SetKVS(scanner.Text(), defaultKVS()); err != nil {
|
||||
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user