2023-05-03 11:43:21 +00:00
|
|
|
import { Module } from '@nestjs/common';
|
2023-06-06 10:53:59 +00:00
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
2023-05-03 15:31:26 +00:00
|
|
|
import { AdModule } from './modules/ad/ad.module';
|
2023-06-06 10:53:59 +00:00
|
|
|
import {
|
|
|
|
MessageBrokerModule,
|
|
|
|
MessageBrokerModuleOptions,
|
|
|
|
} from '@mobicoop/message-broker-module';
|
|
|
|
import {
|
|
|
|
ConfigurationModule,
|
|
|
|
ConfigurationModuleOptions,
|
|
|
|
} from '@mobicoop/configuration-module';
|
2023-06-20 14:50:55 +00:00
|
|
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
|
|
|
import { RequestContextModule } from 'nestjs-request-context';
|
2023-06-21 10:31:59 +00:00
|
|
|
import { HealthModule } from '@modules/health/health.module';
|
2023-05-03 11:43:21 +00:00
|
|
|
|
|
|
|
@Module({
|
2023-05-03 15:31:26 +00:00
|
|
|
imports: [
|
|
|
|
ConfigModule.forRoot({ isGlobal: true }),
|
2023-06-20 14:50:55 +00:00
|
|
|
EventEmitterModule.forRoot(),
|
|
|
|
RequestContextModule,
|
|
|
|
MessageBrokerModule.forRootAsync({
|
|
|
|
imports: [ConfigModule],
|
|
|
|
inject: [ConfigService],
|
|
|
|
useFactory: async (
|
|
|
|
configService: ConfigService,
|
|
|
|
): Promise<MessageBrokerModuleOptions> => ({
|
|
|
|
uri: configService.get<string>('MESSAGE_BROKER_URI'),
|
|
|
|
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
|
|
|
|
name: 'ad',
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
ConfigurationModule.forRootAsync({
|
|
|
|
imports: [ConfigModule],
|
|
|
|
inject: [ConfigService],
|
|
|
|
useFactory: async (
|
|
|
|
configService: ConfigService,
|
|
|
|
): Promise<ConfigurationModuleOptions> => ({
|
|
|
|
domain: configService.get<string>('SERVICE_CONFIGURATION_DOMAIN'),
|
|
|
|
messageBroker: {
|
2023-06-06 10:53:59 +00:00
|
|
|
uri: configService.get<string>('MESSAGE_BROKER_URI'),
|
|
|
|
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
|
2023-06-20 14:50:55 +00:00
|
|
|
},
|
|
|
|
redis: {
|
|
|
|
host: configService.get<string>('REDIS_HOST'),
|
|
|
|
password: configService.get<string>('REDIS_PASSWORD'),
|
|
|
|
port: configService.get<number>('REDIS_PORT'),
|
|
|
|
},
|
|
|
|
setConfigurationBrokerQueue: 'ad-configuration-create-update',
|
|
|
|
deleteConfigurationQueue: 'ad-configuration-delete',
|
|
|
|
propagateConfigurationQueue: 'ad-configuration-propagate',
|
|
|
|
}),
|
|
|
|
}),
|
2023-06-21 10:31:59 +00:00
|
|
|
HealthModule,
|
2023-05-03 15:31:26 +00:00
|
|
|
AdModule,
|
|
|
|
],
|
2023-05-03 11:43:21 +00:00
|
|
|
controllers: [],
|
|
|
|
providers: [],
|
|
|
|
})
|
|
|
|
export class AppModule {}
|