Managing multiple Google Drive Client IDs in single rclone.conf

I manage a few rclone processes, one for mount, one for batch copy, etc.

I'd like to have each process use their own Google Drive Client ID, but use the same global rclone config. I've authorized each Client ID. Then I provide the client ID and secret via Environment variables in systemd. But that doesn't seem to work as each rclone process fight over the token parm in the single rclone.conf.

Does anyone have any ideas on how this could be managed? Non-ideal solutions I can think of are:

  1. Separate rclone.conf for each process
  2. Seperate remote for each process

Not sure that's ideal as you have to manage 3 tokens so you need a config for each token. If your config is static, why not have 3 sections and just let it roll? What's the downside?

I guess the downside is having to manage n remotes in a config which could potentially get confusing. Especially if you want to associate multiple remotes with a single client ID.

Something like this I guess would work:

[gdrive_mount]
type = drive
token = {"access_token":"", "token_type": Bearer, "refresh_token": "", "expiry": ""}

[gdrive_copya]
type = drive
token = {"access_token":"", "token_type": Bearer, "refresh_token": "", "expiry": ""}

[gdrive_copyb]
type = drive
token = {"access_token":"", "token_type": Bearer, "refresh_token": "", "expiry": ""}

I'd personally prefer something like this and let rclone manage it. But I guess that's not possible:

[gdrive]
type = drive
token = {
    "client1.apps.googleusercontent.com": {
		"access_token": "",
		"token_type": "Bearer",
		"refresh_token": "",
		"expiry": ""
	},
	"client2.apps.googleusercontent.com": {
		"access_token": "",
		"token_type": "Bearer",
		"refresh_token": "",
		"expiry": ""
	}
}

Then maybe if rclone cannot match a client ID, maybe it uses another node as "default": {}

The reason for all this is so I can associate API errors in Google Cloud console with a specific rclone process.

rclone needs write access for each token so you'd get some funkiness trying to share.

You could do a client ID for each one I guess as it depends on how much you want to control.

Is there a reason you are that concerned about errors? I kind of fire and forget these days as things just work with primarily no errors in the console so I'd have no reason to check.

The main reason I'd like to do this is to have better insights into the Google API console. So take the recent HTTP 429 API problems, for example. From the API console, it wasn't immediately clear which of my rclone processes were impacted. Since they were on a single API key, I couldn't tell.

If you weren't using a user-agent, it would have been all of them :slight_smile: but I get what you mean.

Could you take all the different remotes and union them with mergerfs and round-robin your access between them all?

I'm not trying to combine the remotes as one file system.

I'm just trying to segment Client IDs between rclone processes under a single .conf

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