mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01: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:
@@ -332,6 +332,10 @@ func SetConfigPath(path string) (err error) {
|
||||
|
||||
// SetData sets new config file storage
|
||||
func SetData(newData Storage) {
|
||||
// If no config file, use in-memory config (which is the default)
|
||||
if configPath == "" {
|
||||
return
|
||||
}
|
||||
data = newData
|
||||
dataLoaded = false
|
||||
}
|
||||
@@ -371,10 +375,6 @@ var ErrorConfigFileNotFound = errors.New("config file not found")
|
||||
// SaveConfig calling function which saves configuration file.
|
||||
// if SaveConfig returns error trying again after sleep.
|
||||
func SaveConfig() {
|
||||
if configPath == "" {
|
||||
fs.Debugf(nil, "Skipping save for memory-only config")
|
||||
return
|
||||
}
|
||||
ctx := context.Background()
|
||||
ci := fs.GetConfig(ctx)
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user