prisma skips environment variable loading with config file?

is there a way to pass the environment variables in the config file https://www.prisma.io/docs/orm/reference/prisma-config-reference instead of using dotenv(). this originally automatically worked specifying the env varible in schema.prisma but breaks with the config file
Reference documentation for the prisma config file | Prisma Documen...
This page gives an overview of all Prisma config options available for use.
5 Replies
Prisma AI Help
Prisma AI Help2mo ago
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
Nurul
Nurul2mo ago
Hey! If I understand correctly you would like to use env variables in prisma config file but would not like to use dotenv?
ryanisaboi1
ryanisaboi1OP2mo ago
yep.
RG
RG5w ago
@ryanisaboi1 I faced the same situation that in my production we don't use dotenv its all IAM so what i did is just installed dotenv & import 'dotenv/config' at prisma.config.ts top level, that will help the env varible to load from .env file at our root ( which is not pushing to production) only for developement purpose. at production since there is no .env file it takes the process.env varibles from IAM
Nurul
Nurul4w ago
Thanks for sharing your solution 👍

Did you find this page helpful?