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

feat: Add Async Configuration Support to NestJS Module #760

Conversation

AljazOblonsek
Copy link
Contributor

Description

This PR extends the NestJS Dynamic Module by adding support for async configuration.

The async configuration allows us to inject/import modules or services we need to construct the module.

Example scenario of our usecase:

ConfigModule.forRoot({ envFilePath: './.env' }),
BullBoardModule.forRootAsync({
  imports: [ConfigModule], // Import Nest configuration module
  inject: [ConfigService], // Inject Nest configuration service
  useFactory: (configService: ConfigService) => ({
    route: configService.getOrThrow('QUEUE_PATH'), // Get path from Nest configuration service
    adapter: ExpressAdapter,
  })
}),

Type of change

  • New feature (non-breaking change which adds functionality)

@felixmosh
Copy link
Owner

@DennisSnijder, can you review & approve this change?

Copy link
Contributor

@DennisSnijder DennisSnijder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for your contribution @AljazOblonsek !

@felixmosh felixmosh merged commit 479a190 into felixmosh:master May 30, 2024
3 checks passed
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.

3 participants