R
Railway•11mo ago
TehYoshi

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:
Yea make it so it doesn't produce an error, that is the recommended way to solve this
Jump to solution
9 Replies
Percy
Percy•11mo ago
Project ID: N/A
Fragly
Fragly•11mo ago
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 tab
TehYoshi
TehYoshi•11mo ago
Thanks for the quick reply, I have done this but still errors out because it cant find the file
Fragly
Fragly•11mo ago
Guessing whatever you're using to read your .env file is looking for a .env file and errors when it can't find one
TehYoshi
TehYoshi•11mo ago
yes I can change this so that it does not produce an error just wanted to know if it was best practice or not^
Solution
Fragly
Fragly•11mo ago
Yea make it so it doesn't produce an error, that is the recommended way to solve this
TehYoshi
TehYoshi•11mo ago
ok thank you
Fragly
Fragly•11mo ago
No problem at all 🙂
Brody
Brody•11mo ago
make it produce only a warning, and dont exit the program
Want results from more Discord servers?
Add your server