Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for More .env Files #3226

Open
laugharn opened this issue Aug 6, 2020 · 8 comments
Open

Add Support for More .env Files #3226

laugharn opened this issue Aug 6, 2020 · 8 comments

Comments

@laugharn
Copy link

laugharn commented Aug 6, 2020

Problem

I primarily use Prisma with Next.js, and since Next 9.4 they've implemented automatic .env detection, based on Create React App's pattern: https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used

When doing local development, my DATABASE_URL variable is kept in .env.local, which isn't found by default when I run prisma generate so Prisma commands tend to require some overhead/repetition in my repo.

Suggested solution

Support for the additional .env files used by the popular JS meta frameworks.

Alternatives

A set of local development-specific Prisma commands using dotenv-cli

@rolivegab
Copy link

I would like to see this feature too.
It'll be very useful for develop with Next.js, for example.
See next.js .env configuration here: https://nextjs.org/docs/basic-features/environment-variables

@flybayer
Copy link

Yes! We also need this for Blitz. Here's another issue for the same thing: #3720

@kevinwolfcr
Copy link

This would be very helpful, currently, my solution is proxying prisma through an npm script that uses dotenv-cli. Happy to help with a PR if needed.

@pantharshit00 pantharshit00 added the team/client Issue for team Client. label Apr 23, 2021
@mikeedwards83
Copy link

Bump on this request

@drewhoffer
Copy link

Any update on this? Would really like to use other files depending on my environment.

@ranlix
Copy link

ranlix commented May 12, 2022

Any update about this?
I just add DATABASE_URL in to nextjs .env file, but got error: Environment variable not found: DATABASE_URL. when run npx prisma migrate dev

@janpio janpio changed the title Add Support for More .env Files Add Support for More .env Files May 18, 2023
@hassan-debug
Copy link

hassan-debug commented Jun 23, 2023

i have my .env.local file but still prisma is unable to read environment variables

datasource db {
  provider = "postgresql"
  url = env("POSTGRES_PRISMA_URL") // uses connection pooling

}

@janpio
Copy link
Member

janpio commented Jun 23, 2023

Yes, Prisma does not support this out of the box yet. We have documentation on how you can manually achieve that: https://www.prisma.io/docs/guides/development-environment/environment-variables/using-multiple-env-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests