-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Only support .env
file next to schema.prisma
#1519
Comments
This comment has been minimized.
This comment has been minimized.
It leads to need of two env files. Would suggest to revert it. |
I second this, it leads to worse developer experience overall. |
@homoky @huv1k so you could call
import * as dotenv from "dotenv";
import { PrismaClient } from "@prisma/client";
dotenv.config();
async function main() {
const prisma = new PrismaClient();
const users = await prisma.user.findMany({});
console.log(users);
}
main(); Here I have only one |
@Jolg42 I think that has another side to it that we the cli don't generate client from the root |
@pantharshit00 yes, exactly this :) Now you can't use |
Thanks for the Regarding the CLI, if we can specify the location of the .env file using
that would be helpful, since now I have to symlink my |
Provided solutions are great, but would not be better to keep things clean and simple? |
@homoky I wouldn't be against reverting this change either - I'm all for simplicity, and personally this change has caused more pain than it has solved. |
Also in favor of reverting this, it breaks our pipelines because we use Since there's only support for a |
Can you elaborate on this in a new issue please? Might be an oversight of a use case we are not aware of and just didn't think about. Thanks 🙏 |
Does this suffice? :-) |
Absolutely - as soon as it is an explicit issue someone will think about it sooner or later. |
Is this change not supposed to go for |
Yes, creating a new issue is almost always the solution if something else got closed. I am not super sure what you mean by "go for |
Please reconsider this feature - to keeping two .envs (one for prisma, one for the rest) is confusing. Or please make that backward compatible - read also the root one if exists. |
@dizzyn You can put the |
@janpio Is there a way to point to an |
No, but a request that would enable that is tracked in #1255 Please upvote it if you want this functionality and maybe leave a comment with your usecase. |
Prisma generate does not relay on env, right? |
@Jolg42 it is my mistake, I want to explant that |
So you probably hit the issue in your case, we will issue the fix on Monday :) Thanks! |
@Jolg42 thanks |
I got them working with these scripts, as from this issue
And I serve the environment variables from the
|
As of now, the
prisma2
cli checks and uses a.env
file in the current working directory. We will change this to only read a.env
file which is in the same directory as theschema.prisma
file.As proposed in prisma/prisma-client-js#454, we want to introduce support for a
.env
file in the Prisma Client.As we want to limit the
.env
file usage only to the scope of Prisma and not the whole application, as that's not the responsibility of Prisma, the.env
file will only be used by the Prisma Client, if it is next toschema.prisma
.This change also has to be reflected in the
prisma2
cli, it should only read a.env
file, if it's next to theschema.prisma
file, which is in most cases in the./prisma
directory.The text was updated successfully, but these errors were encountered: