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

ConditionalModule registerWhen support ConfigModule value #1635

Closed
1 task done
peterLam2 opened this issue Feb 21, 2024 · 1 comment
Closed
1 task done

ConditionalModule registerWhen support ConfigModule value #1635

peterLam2 opened this issue Feb 21, 2024 · 1 comment

Comments

@peterLam2
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

i would try to use a nested yaml file as the custom config value to control if a module is import or not,
however it allow to use the environment variable.

    ConditionalModule.registerWhen(
      DevOnlyEcProductModule,
      (env: NodeJS.ProcessEnv) =>
        env['something.enable'] === true,
    ),

Describe the solution you'd like

It would be good, if this also can be inject a module like following .

    ConditionalModule.registerWhenAsync(
      DevOnlyEcProductModule,
      (config: ConfigService) =>
        config.get('something.enable') === true
    ),

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

can use the custom config instead of rely on the environment variable setting.
Thanks

@kamilmysliwiec
Copy link
Member

Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the #⁠ 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.

@nestjs nestjs locked and limited conversation to collaborators Feb 23, 2024
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

2 participants