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

Generate config object when initializing AppModule #490

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mi-373
Copy link

@mi-373 mi-373 commented Jul 8, 2024

Problem

If I try to use environment value like port: parseInt(process.env.PORT, 10) || 3000, instead of hard coded values, current implementation doesn't get correct value from .env.

Solution

I moved config object into function, now the config object will be generated on ConfigModule.forRoot({ isGlobal: true, load: [config] }) and we can get values from .env if we want.

source: https://docs.nestjs.com/techniques/configuration#custom-configuration-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant