6 months ago
I've made REST api with GO, I've used gogetenv
to load the .env
file, but it doesn't find it in the Railway environment and the app crashes
4 Replies
6 months ago
You shouldn't have .env
files in production, if you want to load environment variables then you can do so in the service's Variables
tab. I don't have experience with Go
but you'll need to make gogetenv
fail gracefully if it doesn't find a .env
file
6 months ago
Thanks I solved the issue, it was quite unique how Go handles these scenarios
dev
You shouldn't have .env files in production, if you want to load environment variables then you can do so in the service's Variables tab. I don't have experience with Go but you'll need to make gogetenv fail gracefully if it doesn't find a .env file
6 months ago
Thanks I solved the issue, it was quite unique how Go handles these scenarios
I just had to prevent the panic/fail and fallback to system default to make it work
Status changed to Solved dev • 6 months ago