config: make config create/update encrypt passwords where necessary

Before this change when using "rclone config create" it wasn't
possible to add passwords in one go, it was necessary to call "rclone
config password" to add the passwords afterwards as "rclone config
create" didn't obscure passwords.

After this change "rclone config create" and "rclone config update"
will obscure passwords as necessary as will the corresponding API
calls config/create and config/update.

This makes "rclone config password" and its API config/password
obsolete, however they will be left for backwards compatibility.
This commit is contained in:
Nick Craig-Wood
2019-06-10 18:08:55 +01:00
parent f681d32996
commit 903ede52cd
4 changed files with 126 additions and 23 deletions
+11 -1
View File
@@ -98,6 +98,9 @@ Note that if the config process would normally ask a question the
default is taken. Each time that happens rclone will print a message
saying how to affect the value taken.
If any of the parameters passed is a password field, then rclone will
automatically obscure them before putting them in the config file.
So for example if you wanted to configure a Google Drive remote but
using remote authorization you would do this:
@@ -125,10 +128,14 @@ var configUpdateCommand = &cobra.Command{
Update an existing remote's options. The options should be passed in
in pairs of <key> <value>.
For example to update the env_auth field of a remote of name myremote you would do:
For example to update the env_auth field of a remote of name myremote
you would do:
rclone config update myremote swift env_auth true
If any of the parameters passed is a password field, then rclone will
automatically obscure them before putting them in the config file.
If the remote uses oauth the token will be updated, if you don't
require this add an extra parameter thus:
@@ -168,6 +175,9 @@ should be passed in in pairs of <key> <value>.
For example to set password of a remote of name myremote you would do:
rclone config password myremote fieldname mypassword
This command is obsolete now that "config update" and "config create"
both support obscuring passwords directly.
`,
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(3, 256, command, args)