how do you guys handle env vars per environment (d...
# prisma-whats-new
g
how do you guys handle env vars per environment (dev, staging, production)? I can only think of two ways - pass them manually when running
graphcool deploy
or a shells script per environment e.g
./deploy-prd.sh
f
I personally use env files containing my exports and source them on the terminal before using
gc deploy
To make sure I don't get mixed up my prompt color changes when I source a file, it gets green when I sourced dev, orange when I sourced staging and red when I source prod
πŸ‘πŸ» 1
p
great idea with the colors πŸ‘
g
nice, thanks @florian
f
One last thing I can share, I managed my env files in git, here is my env folder locally:
Copy code
env/
β”œβ”€β”€ .envrc.dev #.gitignored
β”œβ”€β”€ .envrc.dev.secret
β”œβ”€β”€ .envrc.prod #.gitignored
β”œβ”€β”€ .envrc.prod.secret
β”œβ”€β”€ .envrc.staging #.gitignored
└── .envrc.staging.secret
Only the .secret files are commited (others are ignored). The secret files are encoded with gnupg which allows acl to each files (All developers have access to the dev file, only the Lead dev and I have access to the staging and prod ones)
πŸ‘ 1
g
thats perfect, thanks.
m
We’re using Torus - https://www.torus.sh/
πŸ‘πŸ» 3
πŸ‘ 1
🦜 1
g
awesome, thanks guys