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
Feature idea: support for .env.*.local by default #601
Comments
Hi @jmcdo29 thanks for your answer. I see I didn't make my point very clear. What I'm proposing here is to have this behavior by default. Coming from other frameworks I expected this to be the default behavior, not to have to define this myself |
Hmm, personally I'd rather just keep |
As @jmcdo29 pointed out above, this is already doable. The current default behavior mimics the underlying lib's behavior (dotenv) that we use for loading env vars. Currently, there're no plans to change this. |
Hi, I want to propose this feature.
I see it's a common practice for frameworks to support multiple .env files by default, with specific order of precedence between them.
For example, a regular web app could contain
The 3 files are versioned on git, and on each environment (local, prod, etc...) there's an extra *.local file. E.g.
The order of precedence is
.env.{ENV}.local
>.env.{ENV}
>.env.local
>.env
Example nextjs:
https://nextjs.org/docs/basic-features/environment-variables
https://github.com/vercel/next.js/blob/canary/packages/next-env/index.ts#L82
Example symfony:
https://symfony.com/doc/current/configuration.html#overriding-environment-values-via-env-local
https://github.com/symfony/symfony/blob/46ca50fd843b71ed5fc4517f5d87e04fdfb87768/src/Symfony/Component/Dotenv/Dotenv.php#L109
I'll be happy to implement this on the @nestjs/config package
The text was updated successfully, but these errors were encountered: