Hey there, I'm trying to use the configService instance in a dynamic module, but I'm not sure how to do it. Here's my code:
@Module({})
export class CronModule {
static register(): DynamicModule {
const imports = [
CqrsModule,
];
if (configService.nestCronEnabled) {
imports.push(DevCronModule);
}
return {
imports,
module: CronModule,
controllers: [CronController],
providers: [CronKeyStrategy, InvoiceRepository],
};
}
}
I want to add CronModule based on ConfigService getter, how can i get the configService instance here ? Thanks !
If i create a new instance it look to work but I'm afraid of side effects :
const configService = new ConfigService();
if (configService.nestCronEnabled) {
imports.push(DevCronModule);
}