I am trying to create sync app with Electron that will sync folder with Google Cloud Storage. The app is for users so they can’t use terminal commands. I can include rclone.exe in installation folder so that Node.js can run bash scripts. The problem is that rclone needs configs. How can i provide already configured rclone client ? So when the user downloads the app rclone for Google Cloud Storage is already configured and Node.js can easily run bash scripts.
You probably want to set up a service account for google cloud storage then you can make an rclone config specifically for your app. You can then pass it in using the
--config file. Or you can pass in the config with environment variables if you prefer.
I’m assuming you want the users to use your google cloud storage account?
Do you trust the users? If not then you’ll need to lock the permissions down on the service account.
Hey @ncw . i have service account. There will be authentication in the app, so security is ok. Yes i want all users to use that service account for syncing files. There will be folder for each user in Cloud Storage.
OK i found my config file. Does it mean that i can also include that file in installation folder so that rclone will use it as config ? and how do i tell rclone to use this file as config ? can you provide minimum example of --config flag please ?
This is what I’d do - I’d configure rclone via environment variables rather than include the config file.
So look in your config file and for every (non blank) entry, etc set a config variable like this. Note that you can put the contents of the service file in here directly too
RCLONE_CONFIG_GCS_TYPE = "google cloud storage" RCLONE_CONFIG_GCS_PROJECT_NUMBER = 123123123 RCLONE_CONFIG_GCS_OBJECT_ACL = "private" RCLONE_CONFIG_GCS_BUCKET_ACL = "private" RCLONE_CONFIG_GCS_LOCATION = "europe-west2" RCLONE_CONFIG_GCS_SERVICE_ACCOUNT_CREDENTIALS = "Contents of service account file"
This will then make an rclone remote called
gcs: which you can use as normal. You can change the
GCS to be anything you like of course.
ok, thanks i will try
Hey @ncw again. Sorry for these questions. i tried as you suggested above with env. variables but after setting variables i couldn’t get rclone working. there was no such remote.
this is the screenshot of my env. variables (windows 10)
Also even if this works how this can help me achieve my goal ? I have to tell my users to set such env variables in order my .exe file to work. I can create a .cmd file to create those first and then run the app but having my credentials inside each users computer is very insecure, isn’t it ?
Maybe i’ve have explained my problem not correctly, sorry for that.
I have .exe file which runs bash scripts like
rclone copy -from- _to_ and vice versa . In my computer i have configured rclone and everything works. What i want to do is to upload my app so other users can download it and use. It’s ok that they will upload their files to my Google Storage Bucket. The problem is when they will download my app (rclone.exe file will be included), rclone wont be configured. So either they need to do it manually with
rclone config > new ....., or to set up env. variables . What can i do with rclone in this situation ?
Are you using
gcs: as the remote?
No, you set the environment variables within your .exe before you run rclone. That way the credentials stay in your exe. This isn’t particularly secure, so make sure your service account is locked down.
Are you uploading or downloading stuff to GCS?
Hey @ncw. I got it working with removing quotes. e.g. instead of doing
set RCLONE_CONFIG_GCS_TYPE = "google cloud storage"
set RCLONE_CONFIG_GCS_TYPE = google cloud storage.
Also thanks for hint about .exe setting variables. I use node.js so in my app i simply do
process.env['RCLONE_CONFIG_GCS_TYPE'] = "google cloud storage"
and everything works.
Great - that is where I was hoping you’d get to!