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 { UserModule } from './modules/user/user.module'; import { ConfigurationModule, ConfigurationModuleOptions, } from '@mobicoop/configuration-module'; import { MessageBrokerModule, MessageBrokerModuleOptions, } from '@mobicoop/message-broker-module'; @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true }), AutomapperModule.forRoot({ strategyInitializer: classes() }), UserModule, MessageBrokerModule.forRootAsync( { imports: [ConfigModule], inject: [ConfigService], useFactory: async ( configService: ConfigService, ): Promise => ({ uri: configService.get('MESSAGE_BROKER_URI'), exchange: configService.get('MESSAGE_BROKER_EXCHANGE'), handlers: {}, }), }, false, ), 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'), }, setConfigurationBrokerRoutingKeys: [ 'configuration.create', 'configuration.update', ], deleteConfigurationRoutingKey: 'configuration.delete', propagateConfigurationRoutingKey: 'configuration.propagate', setConfigurationBrokerQueue: 'user-configuration-create-update', deleteConfigurationQueue: 'user-configuration-delete', propagateConfigurationQueue: 'user-configuration-propagate', }), }, true, ), HealthModule, ], controllers: [], providers: [], }) export class AppModule {}