Skip to content
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

Merged
merged 2 commits into from
Jun 15, 2019

Conversation

czosnek16
Copy link
Contributor

@czosnek16 czosnek16 commented May 29, 2019

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

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@czosnek16
Copy link
Contributor Author

After executing command RCLONE_CONFIG_PASS=abcd rclone --config /tmp/config config update newremote type drive new encrypted config was created.

Copy link
Member

@ncw ncw left a 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.

if err != nil {
if os.IsNotExist(err) {
if len(configKey) == 0 && envpw != "" {
Copy link
Member

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

if len(configKey) == 0 && envpw != "" {
err := setConfigPassword(envpw)
if err != nil {
fmt.Println("Using RCLONE_CONFIG_PASS returned:", err)
Copy link
Member

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(

if len(configKey) == 0 && envpw != "" {
err := setConfigPassword(envpw)
if err != nil {
fs.Errorf(nil, "Using RCLONE_CONFIG_PASS returned:", err)

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)

@ncw
Copy link
Member

ncw commented Jun 10, 2019

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 :-)

@ncw
Copy link
Member

ncw commented Jun 15, 2019

Thank you for this :-)

Will merge now.

@ncw ncw merged commit 2793d4b into rclone:master Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants