import { Module } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; // import { HealthModule } from './modules/health/health.module'; import { AdModule } from './modules/ad/ad.module'; import { AutomapperModule } from '@automapper/nestjs'; import { classes } from '@automapper/classes'; import { MessageBrokerModule, MessageBrokerModuleOptions, } from '@mobicoop/message-broker-module'; import { ConfigurationModule, ConfigurationModuleOptions, } from '@mobicoop/configuration-module'; import { EventEmitterModule } from '@nestjs/event-emitter'; import { RequestContextModule } from 'nestjs-request-context'; @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true }), EventEmitterModule.forRoot(), RequestContextModule, AutomapperModule.forRoot({ strategyInitializer: classes() }), MessageBrokerModule.forRootAsync({ imports: [ConfigModule], inject: [ConfigService], useFactory: async ( configService: ConfigService, ): Promise => ({ uri: configService.get('MESSAGE_BROKER_URI'), exchange: configService.get('MESSAGE_BROKER_EXCHANGE'), name: 'ad', }), }), ConfigurationModule.forRootAsync({ imports: [ConfigModule], inject: [ConfigService], useFactory: async ( configService: ConfigService, ): Promise => ({ domain: configService.get('SERVICE_CONFIGURATION_DOMAIN'), messageBroker: { uri: configService.get('MESSAGE_BROKER_URI'), exchange: configService.get('MESSAGE_BROKER_EXCHANGE'), }, redis: { host: configService.get('REDIS_HOST'), password: configService.get('REDIS_PASSWORD'), port: configService.get('REDIS_PORT'), }, setConfigurationBrokerQueue: 'ad-configuration-create-update', deleteConfigurationQueue: 'ad-configuration-delete', propagateConfigurationQueue: 'ad-configuration-propagate', }), }), // HealthModule, AdModule, ], controllers: [], providers: [], }) export class AppModule {}