Using .env file
I am deploying a Golang app and use a .env file on my local and read it with godotenv. I error out if it does not detect this file. Railway does not use env files so ofc it errors out. Is there any way to get Railway to use .env files? Or should I just not produce an error on my local for no .env file.
Solution:Jump to solution
Yea make it so it doesn't produce an error, that is the recommended way to solve this
9 Replies
Project ID:
N/A
You'd want to put everything that would go in your
.env
file in the Service Variables located in your service settings in the Variables
tabThanks for the quick reply, I have done this but still errors out because it cant find the file
Guessing whatever you're using to read your
.env
file is looking for a .env
file and errors when it can't find oneyes
I can change this so that it does not produce an error just wanted to know if it was best practice or not^
Solution
Yea make it so it doesn't produce an error, that is the recommended way to solve this
ok thank you
No problem at all 🙂
make it produce only a warning, and dont exit the program