How to use dotenv-vault
Anonymous
FREEOP

2 years 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

9 Replies

Anonymous
FREEOP

2 years ago

ed9d81eb-a192-462c-8cf6-bf7778244e57


2 years ago

any reason you want to use that over the service variables?


Anonymous
FREEOP

2 years ago

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.


2 years ago

why can't the service variables be your one place?


2 years ago

maybe you are unaware of the railway run or railway shell commands?


Anonymous
FREEOP

2 years ago

Yes it can be but I wanted to explore this one, is it possible?


2 years 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


Anonymous
FREEOP

2 years ago

I believe during build .env.production is getting created, just wanted to make railway know to use that file


2 years ago

nothing to do with railway, your code needs to use it


Loading...