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
-
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:
build
command must useNODE_ENV=production
anddev
must useNODE_ENV=development
.NODE_ENV=test blitz build
NODE_ENV
inside your app code to conditionally do things based on different environments.Proposed Solution
Use
APP_ENV
to determine app environment instead ofNODE_ENV
.NODE_ENV
will only be used forblitz dev
vsblitz build
.The value of
APP_ENV
will determine which.env.[ENV].*
files will be loaded.APP_ENV=development
forblitz dev
APP_ENV=production
forblitz build
andblitz start
APP_ENV=test
for Jest testsAPP_ENV=test blitz start
-e
flag likeblitz start -e test
With this solution, you can set
APP_ENV
to any string. Example:APP_ENV=staging
which would load.env.staging
Any and all feedback is welcome!
Beta Was this translation helpful? Give feedback.
All reactions