import { classes } from '@automapper/classes'; import { AutomapperModule } from '@automapper/nestjs'; import { Module } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; import { HealthModule } from './modules/health/health.module'; import { MatcherModule } from './modules/matcher/matcher.module'; import { AdModule } from './modules/ad/ad.module'; import { ConfigurationModule, ConfigurationModuleOptions, } from '@mobicoop/configuration-module'; import { MessageBrokerModule, MessageBrokerModuleOptions, } from '@mobicoop/message-broker-module'; @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true }), 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: 'matcher-configuration-create-update', deleteConfigurationQueue: 'matcher-configuration-delete', propagateConfigurationQueue: 'matcher-configuration-propagate', }), }), MessageBrokerModule.forRootAsync({ imports: [ConfigModule], inject: [ConfigService], useFactory: async ( configService: ConfigService, ): Promise => ({ uri: configService.get('MESSAGE_BROKER_URI'), exchange: configService.get('MESSAGE_BROKER_EXCHANGE'), handlers: { adCreated: { routingKey: 'ad.created', queue: 'matcher-ad-created', }, }, name: 'matcher', }), }), AutomapperModule.forRoot({ strategyInitializer: classes() }), HealthModule, MatcherModule, AdModule, ], controllers: [], providers: [], }) export class AppModule {}