.env file location
RESOLVED
Hi,
I'm deploying a simple API project and cannot figure out where railway is storing the .env file.
I added the variable using the production interface, variables tab, raw editor, ENV.
Any help would be greatly appreciated.
Thanks!
9 Replies
Solved, by appending
echo "$VAR_NAME" > .env
to build commandYou shouldn't need the
.env
file. We automatically pipe your variables in.
Once you add your variable on your service, it should be available to it.how would i use the vars in my node app? ${var_name}?
Like you would in any other node app.
process.env.VAR_NAME_GOES_HERE
.ah great, so i can use it in dev mode as well as in production.
i thought i saw something like ${{varname}} somewhre in the docs
You can use it in dev mode if you're using our CLI and starting your server with
railway run CMD
That's for template variables inside our dashboard.
https://docs.railway.app/develop/variables#templated-variablesyes, i would like to access the template vars in the dashbaord within my app.
Within your app.
.
We just pipe the variables in. Using them within your app works the same way it would irrespective of where you run your app.
ok thanks it works. well. awesome.