Use command line args or env vars in addition to config file
sapk opened this issue · 4 comments
You can completely remove any ~/.rclone.conf or ~/.config/rclone/rclone.conf, they are just consulted for defaults or fallback options. Try this:
rclone copy ./file.txt :sftp:subdir --sftp-host=localhost --sftp-key-file=~/.ssh/id_rsa
You can also add pass options via environment or mix it with CLI arguments:
export RCLONE_SFTP_HOST=localhost
export RCLONE_SFTP_KEY_FILE=~/.ssh/id_rsa
rclone ls :sftp:
Related action items, issues and documentation:
Also in a release after v1.54 rclone plans to natively support being called as a mount helper or from sytemd or automount. See rclone/rclone#992 (comment) and below comments, and rclone/rclone#2968
Yes setting the file path is not mandatory but it is more explicit for other people reading the code.
I know that the arg/env configuration as greatly improve in rclone and de could do a lot better now but I think I will also keep the config file option since it will still be the easiest option to simple pass there rclone file.
For the mount option, I will have a look into it but it seems to be tricky to pass config to it.
I will keep the config file option since it will still be the easiest option to simple pass there rclone file.
Rclone does and will support the environment way as well as command line for passing config file path:
export RCLONE_CONFIG=/path/to/rclone-via-env.conf
rclone --config=/path/to/rclone-override-env.conf mount ...
You can use the former version to pass base64-decoded config, but you'll have to implement the TODO as the <(base64 -d ...)
trick won't work with environment.
For the mount option, I will have a look into it but it seems to be tricky to pass config to it.
In a future mount helper mode the config will be passed as
mount -t rclone -o rw,config=/path/to/rclone.conf ... remote: /mnt/path
However not every cli argument is generally possible to translate to environment as there is gotcha with boolean optons: compare --some-flag mount ...
, --some-flag true mount ...
, --some-flag=true mount ...
etc.