-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Which project is this feature idea for?
Turborepo
Describe the feature you'd like to request
I feel as though many users would greatly benefit from more helpful docs on "Using environment variables".
The only suggestion is to install dotenv-cli and add it infront of the script like "dev": "dotenv -- turbo dev".
I'm currently working on adding prisma to to my monorepo for a shared db client. The turborepo docs on adding prisma are helpful but not in regards to environment variables like the DATABASE_URL.
Describe the solution you'd like
I feel like more suggestions for having a shared .env config in your monorepo would be ideal.
Regardless of how this is handled via a "package" in the monorepo or using a .env file from root without having to manage dotenv-cli especially when having multiple .env files like
.env.local.env.local.development.env.local.production
This would be a great out of the box feature since people usually need some .env managment ESPECIALLY in a monorepo.
Describe alternatives you've considered
I feel as though my [Describe the solution you'd like] section hits this point already.
I've tried using the recommended dotenv-cli approach from the docs and it doesn't work for my use case.
This is the approach I tried using my .env file from root with prisma and turbo:
In root package.json:
"db:migrate": "dotenv -e ./env -- turbo db:migrate"
In packages/database/package.json:
"db:migrate": "prisma migrate dev --name init"
Running npm run db:migrate from root gives me this error message:
database:db:migrate: error: Environment variable not found: DATABASE_URL.
I understand that this could potentially be labeled as an issue with prisma. But, the question still stands for managing environment variables throughout your turborepo