2023-05-26 08:52:52 -04:00
|
|
|
import { getLogLevels, SERVER_VERSION } from '@app/domain';
|
|
|
|
|
import { RedisIoAdapter } 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;
|
|
|
|
|
const envName = (process.env.NODE_ENV || 'development').toUpperCase();
|
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));
|
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-07-26 14:29:35 -04:00
|
|
|
logger.log(`Immich Microservices is listening on ${await app.getUrl()} [v${SERVER_VERSION}] [${envName}] `);
|
2022-06-11 16:12:06 -05:00
|
|
|
}
|