Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

validatePredefined has no effect unless the deprecated ignoreEnvVars is set #1970

Closed
1 of 4 tasks
vincentrolfs opened this issue Feb 27, 2025 · 1 comment
Closed
1 of 4 tasks
Labels
bug Something isn't working

Comments

@vincentrolfs
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Line 68 in config.module.ts has a bug. It says:

if (!options.ignoreEnvVars || options.validatePredefined) {
      config = {
        ...config,
        ...process.env,
      };
}

But the docs say that ignoreEnvVars is deprecated, and one should use validatePredefined instead. But if we do that, then ignoreEnvVars will be unset and thus falsey. Meaning validatePredefined has no effect.

Minimum reproduction code

if (!options.ignoreEnvVars || options.validatePredefined) {

Steps to reproduce

No response

Expected behavior

Correct code should be

if (!options.ignoreEnvVars && (options.validatePredefined !== false)) {
      config = {
        ...config,
        ...process.env,
      };
}

Package version

11

NestJS version

11

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@vincentrolfs vincentrolfs added the bug Something isn't working label Feb 27, 2025
@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants