Anyone worked out a clever way to switch up .env f...
# orm-help
c
Anyone worked out a clever way to switch up .env files on the graphql boilerplate
yarn dev
run command? I would like to usually run the graphql server against the prisma on my local docker but occasionally run the graphql server against a staging environment on my production prisma host.
p
i think the answer there is useful
havent actually tried it tho
c
The thing that is not sorted by that route is the graphql prisma endpoint is just using
process.env.PRISMA_ENDPOINT
so I would have to tell
yarn dev
to use a different .env file to get all the variables for all the projects in the scope of the larger project. Your solution only works when you call
prisma deploy
with the
-e
flag to set a specific environment file.
p
could you modify your
dev
script then to set the right env vars from a
.env
file? maybe a bash script that runs before your dev script
j
I did not have this use case with prisma, but I use https://www.npmjs.com/package/dotenv for these kind of things, in case you weren’t aware of it.
c
dotenv is built into the boilerplate but on its own still doesn't really solve the problem of dynamically selecting the right "env" for each case. However, dotenv scoffs at the idea as outside the 12 factor application 😋