Rclone.conf with dotfiles

Since this is not about a specific command or even a misbehaviour of rclone, I've taken the liberty to remove the sections that are not applicable to this post from the template.

What is the problem you are having with rclone?

Rclone modifies its config file but I'd like to include that in my dotfiles

What is your rclone version (output from rclone version)

rclone version
rclone v1.57.0
- os/version: arch rolling (64 bit)
- os/kernel: 5.15.12-arch1-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.5
- go/linking: dynamic
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The rclone config contents with secrets removed.

[gdrive]
type = drive
scope = drive
token = {"access_token":"<redacted>","token_type":"Bearer","refresh_token":"<redacted>","expiry":"2022-01-02T16:20:13.78171446+01:00"}
team_drive =

It's clear that the tokens need to change but would it be possible to source them from a different file?

Generally I think the guides on the docs page are awesome for standard use cases but I'm a little unclear on how to "play" with the config.

Hi, welcome to the forum.

No, not at the moment. You have environment variables and connection strings to play with in combination with config file, but not sure if you can achieve what you want.

I'm sure implementing more flexibility like this has been discussed though, will see if I can find it..

Edit 1: This may end up somewhat related, but is not really about the same thing:

Edit 2: Found it:

1 Like

Hi hesxenon,

Perhaps we can propose an alternative if you briefly explain why you would like to store the token in a different file.

What are you trying to achieve? and why?

@albertony thanks, the second github issue could absolutely solve my problem. However I don't really need to include other files. I.e. a hardcoded solution where rclone sources config from .conf and the token from .cache/rclone or something like that would be a-ok for me.

@Ole well, I'm storing every configuration I can in a git repo so that I can get back up and running when I destroy my machine, akin to backing up but focused on configuration files. In this situation it's quite annoying that there are (nearly) always changes made to the rclone.conf because I need to carefully manage my commits and resets when I change other configuration files. It also sort of obfuscates other changes that might not be intended (default search engine changed, accidental deletion of files and so on)

I have a similar need and use a solution where my config is stored in a git controlled (re)initialisation script, that looks somewhat like this:

export rclone_password_command=REDACTED
rclone config delete GoogleDrive
rclone config create GoogleDrive drive  scope drive  use_trash true  client_id REDACTED.apps.googleusercontent.com  client_secret REDACTED
rclone config show GoogleDrive:
rclone about GoogleDrive:
rclone lsd GoogleDrive:

which allows me to add the somewhat dynamic rclone.conf to my .gitignore

This solution also handles an encrypted rclone.conf, in case you wish this.

You can find the syntax and more advanced options here:
https://rclone.org/commands/rclone_config_create/
https://rclone.org/commands/rclone_config_update/

At the moment rclone can't keep variadic settings in a separate file. I am planning to get to this in 2022 (no strict terms yet). Please subscribe to

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.