Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Change back to original goconfig package. Add documentation for `--ask-password`.

klauspost84b00b362f66
diff --git a/docs/content/docs.md b/docs/content/docs.md
index eeb317bce..7b3c60416 100644
--- a/docs/content/docs.md
+++ b/docs/content/docs.md
@@ -501,6 +501,12 @@ If it is safe in your environment, you can set the `RCLONE_CONFIG_PASS`
environment variable to contain your password, in which case it will be
used for decrypting the configuration.
+If you are running rclone inside a script, you might want to disable
+password prompts. To do that, pass the parameter
+`--ask-password=false` to rclone. This will make rclone fail instead
+of asking for a password, if if `RCLONE_CONFIG_PASS` doesn't contain
+a valid password.
+
Developer options
-----------------
diff --git a/fs/config.go b/fs/config.go
index 54291de22..125c5a775 100644
--- a/fs/config.go
+++ b/fs/config.go
@@ -24,7 +24,7 @@ import (
"time"
"unicode/utf8"
- "github.com/klauspost/goconfig"
+ "github.com/Unknwon/goconfig"
"github.com/mreiferson/go-httpclient"
"github.com/spf13/pflag"
"golang.org/x/crypto/nacl/secretbox"
@@ -325,8 +325,8 @@ func LoadConfig() {
func loadConfigFile() (*goconfig.ConfigFile, error) {
b, err := ioutil.ReadFile(ConfigPath)
if err != nil {
- log.Printf("Failed to load config file %v - using defaults: %v", ConfigPath, err)
- return goconfig.LoadFromData(nil)
+ log.Printf("Failed to load config file \"%v\" - using defaults: %v", ConfigPath, err)
+ return goconfig.LoadFromReader(&bytes.Buffer{})
}
// Find first non-empty line
@@ -335,7 +335,7 @@ func loadConfigFile() (*goconfig.ConfigFile, error) {
line, _, err := r.ReadLine()
if err != nil {
if err == io.EOF {
- return goconfig.LoadFromData(b)
+ return goconfig.LoadFromReader(bytes.NewBuffer(b))
}
return nil, err
}
@@ -350,7 +350,7 @@ func loadConfigFile() (*goconfig.ConfigFile, error) {
if strings.HasPrefix(l, "RCLONE_ENCRYPT_V") {
return nil, fmt.Errorf("Unsupported configuration encryption. Update rclone for support.")
}
- return goconfig.LoadFromData(b)
+ return goconfig.LoadFromReader(bytes.NewBuffer(b))
}
// Encrypted content is base64 encoded.
@@ -400,7 +400,7 @@ func loadConfigFile() (*goconfig.ConfigFile, error) {
configKey = nil
envpw = ""
}
- return goconfig.LoadFromData(out)
+ return goconfig.LoadFromReader(bytes.NewBuffer(out))
}
// getPassword will query the user for a password the