-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable creating encrypted config through external script invocation #3233
Conversation
After executing command RCLONE_CONFIG_PASS=abcd rclone --config /tmp/config config update newremote type drive new encrypted config was created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
I wrote some notes about trying to remove the duplicated code.
fs/config/config.go
Outdated
if err != nil { | ||
if os.IsNotExist(err) { | ||
if len(configKey) == 0 && envpw != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should move this block (and the envpw := os.Getenv("RCLONE_CONFIG_PASS")
) right to the start of the function, then we can remove the duplicate code below
fs/config/config.go
Outdated
if len(configKey) == 0 && envpw != "" { | ||
err := setConfigPassword(envpw) | ||
if err != nil { | ||
fmt.Println("Using RCLONE_CONFIG_PASS returned:", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you fancy tidying up, this should be fs.Errorf(nil,
instead of fmt.Println(
fs/config/config.go
Outdated
if len(configKey) == 0 && envpw != "" { | ||
err := setConfigPassword(envpw) | ||
if err != nil { | ||
fs.Errorf(nil, "Using RCLONE_CONFIG_PASS returned:", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf: Errorf call has arguments but no formatting directives (from govet
)
I think you need to remove this line https://github.com/ncw/rclone/blob/2c72e7f0a219069d1e045fce7db4d9fa27ad82f2/fs/config/config.go#L310 To stop the ineffassign checker moaning. Then I can merge :-) |
Thank you for this :-) Will merge now. |
What is the purpose of this change?
Enable creating new encrypted config, via external script invocation.
Was the change discussed in an issue or in the forum before?
#3127
Checklist