Skip to content
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

How does it support multiple env files? #264

Closed
zhaoyi0113 opened this issue Jun 22, 2020 · 3 comments
Closed

How does it support multiple env files? #264

zhaoyi0113 opened this issue Jun 22, 2020 · 3 comments

Comments

@zhaoyi0113
Copy link

I am looking through this instruction: https://docs.nestjs.com/techniques/configuration to setup env file for my nestjs application.

I see it supports creating multiple config files: envFilePath: ['.env.development.local', '.env.development'], but I wonder how it supports dynamically choose environment file based on NODE_ENV.

I have three env files: .env.dev, .dev.staging, .dev.prod. And I usually use NODE_ENV=dev env to set the current environment. How does nestjs/dev work with NODE_ENV. Can it pick one based on its value?

@kamilmysliwiec
Copy link
Member

but I wonder how it supports dynamically choose environment file based on NODE_ENV.

For example:

envFilePath: `.env.${process.env.NODE_ENV}`

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.

@kamalkech
Copy link

@kamilmysliwiec that s not working, still load .env prod even if we add commands in packages file to set NODE_ENV

@micalevisk
Copy link
Member

@kamalkech this might help you https://docs.nestjs.com/techniques/configuration#custom-env-file-path

I'm using envFilePath with no worries.

@nestjs nestjs locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants