Need help with deployment
Subject: Seeking Guidance on Loading Environment Variables in Railway for My Go API Deployment
Hi everyone,
I hope you're all doing well. I'm currently working on deploying my Go API on Railway, and I've run into a bit of a challenge. Specifically, I need to figure out how to load environment variables from a
.env
file in Railway. Locally, I've been able to load these variables successfully.
Here's a snippet of my .env
file for reference:
In my main.go
file, I'm loading these environment variables like this:
Now, the challenge I'm facing is how to load the cred.json
file in Railway, as it primarily supports key-value pairs for environment variables.
You can find my GitHub repository with the code here: Jobs-Scraper on GitHub
I would greatly appreciate any guidance or suggestions on how to tackle this issue and successfully deploy my Go API on Railway.
Thank you in advance for your assistance!
Project ID: 455cfb5c-e03f-4d7c-81b7-1e2a12858525
Best regards,
MabudGitHub
GitHub - Pavel401/Jobs-Scraper
Contribute to Pavel401/Jobs-Scraper development by creating an account on GitHub.
3 Replies
Project ID:
N/A
Project ID : sweltering-air
Project ID: 455cfb5c-e03f-4d7c-81b7-1e2a12858525
id recommend storing that credentials file on a volume
https://docs.railway.app/reference/volumes
but you can deploy this template
https://railway.app/template/Nan7Bs
it will come with a volume, then upload that json credentials file to it, unmount the volume from the template service and then mount it to your go service