2022-12-14 10:37:13 +00:00
|
|
|
import { classes } from '@automapper/classes';
|
|
|
|
import { AutomapperModule } from '@automapper/nestjs';
|
2022-12-13 12:39:06 +00:00
|
|
|
import { Module } from '@nestjs/common';
|
2023-06-02 13:56:23 +00:00
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
2023-03-31 08:10:31 +00:00
|
|
|
import { HealthModule } from './modules/health/health.module';
|
2023-03-31 08:33:59 +00:00
|
|
|
import { UserModule } from './modules/user/user.module';
|
2023-06-02 13:56:23 +00:00
|
|
|
import {
|
|
|
|
ConfigurationModule,
|
|
|
|
ConfigurationModuleOptions,
|
|
|
|
} from '@mobicoop/configuration-module';
|
|
|
|
import {
|
|
|
|
MessageBrokerModule,
|
|
|
|
MessageBrokerModuleOptions,
|
|
|
|
} from '@mobicoop/message-broker-module';
|
2022-12-13 12:39:06 +00:00
|
|
|
|
|
|
|
@Module({
|
2022-12-14 10:37:13 +00:00
|
|
|
imports: [
|
|
|
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
|
|
AutomapperModule.forRoot({ strategyInitializer: classes() }),
|
2023-03-31 08:33:59 +00:00
|
|
|
UserModule,
|
2023-06-02 13:56:23 +00:00
|
|
|
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'),
|
|
|
|
handlers: {},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
ConfigurationModule.forRootAsync(
|
|
|
|
{
|
|
|
|
imports: [ConfigModule],
|
|
|
|
inject: [ConfigService],
|
|
|
|
useFactory: async (
|
|
|
|
configService: ConfigService,
|
|
|
|
): Promise<ConfigurationModuleOptions> => ({
|
|
|
|
domain: configService.get<string>('SERVICE_CONFIGURATION_DOMAIN'),
|
|
|
|
messageBroker: {
|
|
|
|
uri: configService.get<string>('MESSAGE_BROKER_URI'),
|
|
|
|
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
|
|
|
|
},
|
|
|
|
redis: {
|
|
|
|
host: configService.get<string>('REDIS_HOST'),
|
|
|
|
password: configService.get<string>('REDIS_PASSWORD'),
|
|
|
|
port: configService.get<number>('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,
|
|
|
|
),
|
2023-03-31 08:10:31 +00:00
|
|
|
HealthModule,
|
2022-12-14 10:37:13 +00:00
|
|
|
],
|
2022-12-13 12:39:06 +00:00
|
|
|
controllers: [],
|
|
|
|
providers: [],
|
|
|
|
})
|
|
|
|
export class AppModule {}
|