lambrohan / nestjs-meilisearch

Meilisearch module for nestjs applications.
https://www.npmjs.com/package/nestjs-meilisearch
MIT License
22 stars 7 forks source link

Add support of asynchronous registration for module #1

Closed thomasdom closed 2 years ago

thomasdom commented 3 years ago

Currently, this module does not support async registration.

Async registration would be useful for getting configuration variables from ConfigModule, among many other use cases.

We should be able to register the module like this:

MeiliSearchModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: (configService: ConfigService) => ({
    host: configService.get<string>('MEILISEARCH_HOST'),
    apiKey: configService.get<string>('MEILISEARCH_API_KEY'),
  }),
}),
thomasdom commented 2 years ago

@lambrohan Do you still maintain this repository?

lambrohan commented 2 years ago

@thomasdom Yes. I'll add the async registration support very soon.

lambrohan commented 2 years ago

@thomasdom Just did the update. It should support async module registration now.