feat(server/machine-learning): Configurable port (#1386)

* feat(server/machine-learning): Configurable port

* feat(server/machine-learning): Address PR comments.

* feat(server/machine-learning): Simplify

Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Skyler Mäntysaari
2023-01-24 06:18:35 +02:00
committed by GitHub
parent b7d34079d9
commit 9d337bf4dc
4 changed files with 18 additions and 5 deletions

View File

@@ -27,6 +27,8 @@ async function bootstrap() {
app.enableCors();
}
const serverPort = Number(process.env.SERVER_PORT) || 3001;
const redisIoAdapter = new RedisIoAdapter(app);
await redisIoAdapter.connectToRedis();
app.useWebSocketAdapter(redisIoAdapter);
@@ -59,7 +61,7 @@ async function bootstrap() {
customSiteTitle: 'Immich API Documentation',
});
await app.listen(3001, () => {
await app.listen(serverPort, () => {
if (process.env.NODE_ENV == 'development') {
// Generate API Documentation only in development mode
const outputPath = path.resolve(process.cwd(), 'immich-openapi-specs.json');
@@ -67,7 +69,9 @@ async function bootstrap() {
}
const envName = (process.env.NODE_ENV || 'development').toUpperCase();
logger.log(`Running Immich Server in ${envName} environment - version ${SERVER_VERSION}`);
logger.log(
`Running Immich Server in ${envName} environment - version ${SERVER_VERSION} - Listening on port: ${serverPort}`,
);
});
logger.warn(`Machine learning is ${MACHINE_LEARNING_ENABLED ? 'enabled' : 'disabled'}`);