2022-06-11 23:12:06 +02:00
|
|
|
import { Logger } from '@nestjs/common';
|
|
|
|
import { NestFactory } from '@nestjs/core';
|
2023-03-22 03:49:19 +01:00
|
|
|
import { SERVER_VERSION } from '@app/domain';
|
2023-03-24 05:55:15 +01:00
|
|
|
import { getLogLevels } from '@app/domain';
|
2022-06-19 15:16:35 +02:00
|
|
|
import { RedisIoAdapter } from '../../immich/src/middlewares/redis-io.adapter.middleware';
|
2022-06-11 23:12:06 +02:00
|
|
|
import { MicroservicesModule } from './microservices.module';
|
|
|
|
|
2022-12-08 16:53:18 +01:00
|
|
|
const logger = new Logger('ImmichMicroservice');
|
|
|
|
|
2022-06-11 23:12:06 +02:00
|
|
|
async function bootstrap() {
|
2023-01-13 15:23:12 +01:00
|
|
|
const app = await NestFactory.create(MicroservicesModule, {
|
|
|
|
logger: getLogLevels(),
|
|
|
|
});
|
2022-06-11 23:12:06 +02:00
|
|
|
|
2023-01-28 06:12:38 +01:00
|
|
|
const listeningPort = Number(process.env.MICROSERVICES_PORT) || 3002;
|
2023-01-24 05:18:35 +01:00
|
|
|
|
2023-01-12 23:07:27 +01:00
|
|
|
const redisIoAdapter = new RedisIoAdapter(app);
|
|
|
|
await redisIoAdapter.connectToRedis();
|
|
|
|
app.useWebSocketAdapter(redisIoAdapter);
|
2022-06-19 15:16:35 +02:00
|
|
|
|
2023-01-24 05:18:35 +01:00
|
|
|
await app.listen(listeningPort, () => {
|
2022-12-08 16:53:18 +01:00
|
|
|
const envName = (process.env.NODE_ENV || 'development').toUpperCase();
|
2023-01-24 05:18:35 +01:00
|
|
|
logger.log(
|
|
|
|
`Running Immich Microservices in ${envName} environment - version ${SERVER_VERSION} - Listening on port: ${listeningPort}`,
|
|
|
|
);
|
2022-06-11 23:12:06 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
bootstrap();
|