a year ago
I have FE (Vite+React) and BE (Node+Express) apps which is deployed on railway. I came across dotenv-vault and wanted to try it out so for my BE I created a custom build command in railway dashbaord, ideally it should fetch .env.production
file in the repo during build which my app can use later so no need to add environment variables from the dashboard . But it is not working as expected. Attaching Screenshots FYR for BE service.
Build command:
npx dotenv-vault@latest pull production --dotenvMe=me_c82708b0ee3e7aa4a0381d2ab7d1550c40fe205ef570cc693cb54f5f439fc3ba -y
0 Replies
a year ago
any reason you want to use that over the service variables?
Just wanted to have everything at one place, If I make some changes in my local .env I can make that change directly to .env.production and make sure that it will be taken care of without manucal intervention.
a year ago
why can't the service variables be your one place?
a year ago
maybe you are unaware of the railway run
or railway shell
commands?
a year ago
im sure it can be made to work, but i can only help you with what i know, so im always going to recommend a platform native option first
I believe during build .env.production is getting created, just wanted to make railway know to use that file
a year ago
nothing to do with railway, your code needs to use it