2023-10-24 17:05:42 +02:00
|
|
|
import { envName, getLogLevels, serverVersion } from '@app/domain';
|
2023-12-08 11:15:46 -05:00
|
|
|
import { RedisIoAdapter, enablePrefilter } from '@app/infra';
|
2022-06-11 16:12:06 -05:00
|
|
|
import { Logger } from '@nestjs/common';
|
|
|
|
|
import { NestFactory } from '@nestjs/core';
|
2023-06-01 06:32:51 -04:00
|
|
|
import { AppService } from './app.service';
|
2022-06-11 16:12:06 -05:00
|
|
|
import { MicroservicesModule } from './microservices.module';
|
|
|
|
|
|
2022-12-08 10:53:18 -05:00
|
|
|
const logger = new Logger('ImmichMicroservice');
|
2023-06-07 10:56:08 -04:00
|
|
|
const port = Number(process.env.MICROSERVICES_PORT) || 3002;
|
2022-12-08 10:53:18 -05:00
|
|
|
|
2023-06-08 11:01:07 -04:00
|
|
|
export async function bootstrap() {
|
2023-06-07 10:56:08 -04:00
|
|
|
const app = await NestFactory.create(MicroservicesModule, { logger: getLogLevels() });
|
2023-05-26 08:52:52 -04:00
|
|
|
|
2023-03-31 10:36:08 -04:00
|
|
|
app.useWebSocketAdapter(new RedisIoAdapter(app));
|
2023-12-08 11:15:46 -05:00
|
|
|
await enablePrefilter();
|
2022-06-19 08:16:35 -05:00
|
|
|
|
2023-06-07 10:56:08 -04:00
|
|
|
await app.get(AppService).init();
|
|
|
|
|
await app.listen(port);
|
2023-05-20 22:39:12 -04:00
|
|
|
|
2023-10-24 17:05:42 +02:00
|
|
|
logger.log(`Immich Microservices is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
|
2022-06-11 16:12:06 -05:00
|
|
|
}
|