Replies: 2 comments 2 replies
-
|
Would that solution help us to make the ENV loading work better together with prisma? In our deployment, we currently overwrite |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
I've also posted this upstream in Next.js repo: vercel/next.js#25764 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Blitz/Next use basically dotenv-flow to load env var files like
.env,.env.test,.env.development.local, etc.That behavior relies on setting NODE_ENV to the appropriate value before invoking a CLI command.
Problems:
buildcommand must useNODE_ENV=productionanddevmust useNODE_ENV=development.NODE_ENV=test blitz buildNODE_ENVinside your app code to conditionally do things based on different environments.Proposed Solution
Use
APP_ENVto determine app environment instead ofNODE_ENV.NODE_ENVwill only be used forblitz devvsblitz build.The value of
APP_ENVwill determine which.env.[ENV].*files will be loaded.APP_ENV=developmentforblitz devAPP_ENV=productionforblitz buildandblitz startAPP_ENV=testfor Jest testsAPP_ENV=test blitz start-eflag likeblitz start -e testWith this solution, you can set
APP_ENVto any string. Example:APP_ENV=stagingwhich would load.env.stagingAny and all feedback is welcome!
Beta Was this translation helpful? Give feedback.
All reactions