accept inject in the rootAsync
Closed this issue · 2 comments
euberb commented
Allow injection in rootAsync, so we can load settings from env variables.
Example:
NodeIdempotencyModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => {
return {
storage: {
adapter: StorageAdapterEnum.redis,
options: {
url: config.get('redis.url');,
},
},
cacheKeyPrefix: config.get('cache.prefix'),
enforceIdempotency: true,
};
},
}),
Ref: https://github.com/bjerkio/nestjs-slack/blob/main/src/slack.module.ts
mahendraHegde commented
@euberb sounds reasonable, would you be willing to send a PR?
mahendraHegde commented
available in @node-idempotency/nestjs@1.0.5