mirror of
https://github.com/rclone/rclone
synced 2024-12-22 13:03:02 +01:00
enable creating encrypted config through external script invocation - fixes #3127
This commit is contained in:
parent
6e8e620e71
commit
30ac9d920a
@ -226,8 +226,17 @@ var errorConfigFileNotFound = errors.New("config file not found")
|
||||
// automatically decrypt it.
|
||||
func loadConfigFile() (*goconfig.ConfigFile, error) {
|
||||
b, err := ioutil.ReadFile(ConfigPath)
|
||||
envpw := os.Getenv("RCLONE_CONFIG_PASS")
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if len(configKey) == 0 && envpw != "" {
|
||||
err := setConfigPassword(envpw)
|
||||
if err != nil {
|
||||
fmt.Println("Using RCLONE_CONFIG_PASS returned:", err)
|
||||
} else {
|
||||
fs.Debugf(nil, "Using RCLONE_CONFIG_PASS password.")
|
||||
}
|
||||
}
|
||||
return nil, errorConfigFileNotFound
|
||||
}
|
||||
return nil, err
|
||||
@ -266,7 +275,6 @@ func loadConfigFile() (*goconfig.ConfigFile, error) {
|
||||
if len(box) < 24+secretbox.Overhead {
|
||||
return nil, errors.New("Configuration data too short")
|
||||
}
|
||||
envpw := os.Getenv("RCLONE_CONFIG_PASS")
|
||||
|
||||
var out []byte
|
||||
for {
|
||||
|
Loading…
Reference in New Issue
Block a user