2022-02-03 17:06:44 +01:00
|
|
|
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
|
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
|
|
import { databaseConfig } from './config/database.config';
|
|
|
|
import { UserModule } from './api-v1/user/user.module';
|
|
|
|
import { AssetModule } from './api-v1/asset/asset.module';
|
|
|
|
import { AuthModule } from './api-v1/auth/auth.module';
|
|
|
|
import { ImmichJwtModule } from './modules/immich-jwt/immich-jwt.module';
|
|
|
|
import { DeviceInfoModule } from './api-v1/device-info/device-info.module';
|
|
|
|
import { AppLoggerMiddleware } from './middlewares/app-logger.middleware';
|
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
|
|
import { immichAppConfig } from './config/app.config';
|
|
|
|
import { BullModule } from '@nestjs/bull';
|
|
|
|
import { ImageOptimizeModule } from './modules/image-optimize/image-optimize.module';
|
|
|
|
import { ServerInfoModule } from './api-v1/server-info/server-info.module';
|
2022-02-11 03:40:11 +01:00
|
|
|
import { BackgroundTaskModule } from './modules/background-task/background-task.module';
|
2022-02-14 17:40:41 +01:00
|
|
|
import { CommunicationModule } from './api-v1/communication/communication.module';
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Module({
|
|
|
|
imports: [
|
|
|
|
ConfigModule.forRoot(immichAppConfig),
|
|
|
|
TypeOrmModule.forRoot(databaseConfig),
|
|
|
|
UserModule,
|
|
|
|
AssetModule,
|
|
|
|
AuthModule,
|
|
|
|
ImmichJwtModule,
|
|
|
|
DeviceInfoModule,
|
|
|
|
BullModule.forRootAsync({
|
2022-03-27 21:58:54 +02:00
|
|
|
useFactory: async () => ({
|
2022-02-03 17:06:44 +01:00
|
|
|
redis: {
|
2022-02-03 21:42:27 +01:00
|
|
|
host: 'immich_redis',
|
|
|
|
port: 6379,
|
2022-02-03 17:06:44 +01:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
ImageOptimizeModule,
|
|
|
|
|
|
|
|
ServerInfoModule,
|
2022-02-11 03:40:11 +01:00
|
|
|
|
|
|
|
BackgroundTaskModule,
|
2022-02-14 17:40:41 +01:00
|
|
|
|
|
|
|
CommunicationModule,
|
2022-02-03 17:06:44 +01:00
|
|
|
],
|
|
|
|
controllers: [],
|
|
|
|
providers: [],
|
|
|
|
})
|
|
|
|
export class AppModule implements NestModule {
|
|
|
|
configure(consumer: MiddlewareConsumer): void {
|
2022-03-28 22:21:15 +02:00
|
|
|
if (process.env.NODE_ENV == 'development') {
|
|
|
|
consumer.apply(AppLoggerMiddleware).forRoutes('*');
|
|
|
|
}
|
2022-02-03 17:06:44 +01:00
|
|
|
}
|
|
|
|
}
|