Prisma with multi environments
Hello there,
I'm trying to use Prisma for both
development
and production
environment. I have two environment files:
- .env.development
- .env.production
Locally, all I need is .env.development
, so the production file is not relevant here. However, once I deploy it, there will be a .env.production
file present which should be used, but Prisma - as the docs say- don't seem to allow that naming. Is there a way to stick to the name still? I don't want to rename it to just .env
because 1) it's just better naming and 2) my whole app uses that, not just prisma.
Any ideas? PS: I haven't tested deployment yet, I'm just making sure I plan ahead properly3 Replies
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into
#ask-ai
if you get antsy for a second opinion!Hey 👋
You are looking for this guide:
https://www.prisma.io/docs/orm/more/development-environment/environment-variables/using-multiple-env-files
Also a related discussion:
https://github.com/prisma/prisma/discussions/2310
Using multiple .env files. | Prisma Documentation
Learn how to set up a dedicated testing environment using multiple .env files.
GitHub
How to appropriately handle prod/dev environment variables · prisma...
I have a nextjs project set up using prisma in the backend. I largely followed the tutorial but am having difficulties setting the DATABASE_URL when trying to create a production build. I currently...
Thank you! Do you happen to know if it also works with
cross-env
?
It seems like it does work, thank you! (: