From d6d5a08204db357b283c71b8af7feb6c291324bd Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Thu, 20 Mar 2025 20:45:28 +0400 Subject: [PATCH] Allow user to save downloaded keyfile to a different folder --- docs/source/how_to/gsheets_setup.md | 10 +++++++++- scripts/generate_google_services.sh | 28 ++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/docs/source/how_to/gsheets_setup.md b/docs/source/how_to/gsheets_setup.md index 4fb59ff..eefcf9e 100644 --- a/docs/source/how_to/gsheets_setup.md +++ b/docs/source/how_to/gsheets_setup.md @@ -15,10 +15,18 @@ To do this, you can either: * a) follow the steps in [this guide](https://gspread.readthedocs.io/en/latest/oauth2.html) all the way up until step 8. You should have downloaded a file called `service_account.json` and should save it in the `secrets/` folder * b) run the following script to automatically generate the file: ```{code} bash -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/bellingcat/auto-archiver/refs/heads/main/scripts/generate_google_services.sh)" +https://raw.githubusercontent.com/bellingcat/auto-archiver/refs/heads/main/scripts/generate_google_services.sh | bash -s -- ``` This uses gcloud to create a new project, a new user and downloads the service account automatically for you. The service account file will have the name `service_account-XXXXXXX.json` where XXXXXXX is a random 16 letter/digit string for the project created. +```{note} +To save the generated file to a different folder, pass an argument as follows: +```{code} bash +https://raw.githubusercontent.com/bellingcat/auto-archiver/refs/heads/main/scripts/generate_google_services.sh | bash -s -- /path/to/secrets +``` + +---------- + Once you've downloaded the file, you can save it to `secrets/service_account.json` (the default name), or to another file and then change the location in the settings (see step 4). Also make sure to **note down** the email address for this service account. You'll need that for step 3. diff --git a/scripts/generate_google_services.sh b/scripts/generate_google_services.sh index 2668fd3..fb11e37 100644 --- a/scripts/generate_google_services.sh +++ b/scripts/generate_google_services.sh @@ -7,6 +7,7 @@ UUID=$(LC_ALL=C tr -dc a-z0-9