10 months ago
Hi,
I need to upload my Google service account json to a volume attached to my service, but I can't seem to find a way to do that. I don't see a command in the CLI or any way to do it from the UI. What do you recommend?
Thanks
2 Replies
10 months ago
I would recommend placing the contents of the JSON file inside a service variable, and reading from it from inside your app.
Status changed to Awaiting User Response railway[bot] • 10 months ago
4 months ago
Some extra commentary here, because I spent a few hours going through local > deployment loop to figure this out:
```
credentials = service_account.Credentials.from_service_account_info(
json.loads(os.environ.get("GOOGLE_APPLICATION_CREDENTIALS_JSON"))
)
opts = ClientOptions(api_endpoint=f"...")
client = something.yourClient(client_options=opts, credentials=credentials)
```
The JSON needs to be formatted without linebreaks as a single line, the linebreak characters inside of the private_key, don't touch those. But it should be all on the same line, with no external quotes when you paste it into railway. The string you paste into the GOOGLE_APPLICATION_CREDENTIALS_JSON variable should be like:
```
{"type":"service_account", "project_id":"your-project-id",...}
```
No outside quotes!
Status changed to Awaiting Railway Response railway[bot] • 4 months ago
Status changed to Solved brody • 4 months ago