diff --git a/docs/content/docs.md b/docs/content/docs.md index decf9f911..4d0e663d7 100644 --- a/docs/content/docs.md +++ b/docs/content/docs.md @@ -686,8 +686,8 @@ to run in "portable" mode by downloading rclone executable to a writable directory and then create an empty file `rclone.conf` in the same directory. -If the location is set to empty string `""` or the special value -`/notfound`, or the os null device represented by value `NUL` on +If the location is set to empty string `""` or path to a file +with name `notfound`, or the os null device represented by value `NUL` on Windows and `/dev/null` on Unix systems, then rclone will keep the config file in memory only. @@ -1920,11 +1920,12 @@ Nevertheless, rclone will read any configuration file found according to the rules described [above](https://rclone.org/docs/#config-config-file). If an encrypted configuration file is found, this means you will be prompted for password (unless using `--password-command`). To avoid this, you can bypass -the loading of the configuration file by overriding the location with an empty -string `""` or the special value `/notfound`, or the os null device represented -by value `NUL` on Windows and `/dev/null` on Unix systems (before rclone -version 1.55 only this null device alternative was supported). -E.g. `rclone --config="" genautocomplete bash`. +the loading of the default configuration file by overriding the location, +e.g. with one of the documented special values for memory-only configuration: + +``` +rclone genautocomplete bash --config="" +``` Developer options ----------------- diff --git a/fs/config/config.go b/fs/config/config.go index 37ab42ad0..ad5a2f836 100644 --- a/fs/config/config.go +++ b/fs/config/config.go @@ -29,7 +29,7 @@ import ( const ( configFileName = "rclone.conf" hiddenConfigFileName = "." + configFileName - noConfigFile = "/notfound" + noConfigFile = "notfound" // ConfigToken is the key used to store the token under ConfigToken = "token" @@ -113,16 +113,12 @@ var ( Password = random.Password ) -var ( - configPath string - noConfigPath string -) +var configPath string func init() { // Set the function pointers up in fs fs.ConfigFileGet = FileGetFlag fs.ConfigFileSet = SetValueAndSave - noConfigPath, _ = filepath.Abs(noConfigFile) configPath = makeConfigPath() } @@ -320,15 +316,12 @@ func SetConfigPath(path string) (err error) { var cfgPath string if path == "" || path == os.DevNull { cfgPath = "" + } else if filepath.Base(path) == noConfigFile { + cfgPath = "" } else if err = file.IsReserved(path); err != nil { return err - } else { - if cfgPath, err = filepath.Abs(path); err != nil { - return err - } - if cfgPath == noConfigPath { - cfgPath = "" - } + } else if cfgPath, err = filepath.Abs(path); err != nil { + return err } configPath = cfgPath return nil