1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

config: fix in memory config not saving on the fly backend config

Before this fix, saving a :backend config gave the error

    Can't save config "token" = "XXX" for on the fly backend ":backend"

Even when using the in-memory config `--config ""`

This fixes the problem by
- always using the in memory config if it is configured
- moving the check for a :backend config save to the file config backend

It also removes the contents of the config items being saved from the
log which saves confidential tokens being logged.

Fixes #5451
This commit is contained in:
Nick Craig-Wood
2021-07-13 17:41:28 +01:00
parent da36ce08e4
commit 770b3496a1
3 changed files with 11 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ package fs
import (
"os"
"strings"
"github.com/rclone/rclone/fs/config/configmap"
)
@@ -70,14 +69,10 @@ type setConfigFile string
// Set a config item into the config file
func (section setConfigFile) Set(key, value string) {
if strings.HasPrefix(string(section), ":") {
Logf(nil, "Can't save config %q = %q for on the fly backend %q", key, value, section)
return
}
Debugf(nil, "Saving config %q = %q in section %q of the config file", key, value, section)
Debugf(nil, "Saving config %q in section %q of the config file", key, section)
err := ConfigFileSet(string(section), key, value)
if err != nil {
Errorf(nil, "Failed saving config %q = %q in section %q of the config file: %v", key, value, section, err)
Errorf(nil, "Failed saving config %q in section %q of the config file: %v", key, section, err)
}
}