mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	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:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							b7d34079d9
						
					
				
				
					commit
					9d337bf4dc
				
			| @@ -5,7 +5,9 @@ import { Logger } from '@nestjs/common'; | ||||
| async function bootstrap() { | ||||
|   const app = await NestFactory.create(AppModule); | ||||
|  | ||||
|   await app.listen(3003, () => { | ||||
|   const port = Number(process.env.MACHINE_LEARNING_PORT) || 3003; | ||||
|  | ||||
|   await app.listen(port, () => { | ||||
|     if (process.env.NODE_ENV == 'development') { | ||||
|       Logger.log( | ||||
|         'Running Immich Machine Learning in DEVELOPMENT environment', | ||||
|   | ||||
| @@ -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'}`); | ||||
|   | ||||
| @@ -12,13 +12,17 @@ async function bootstrap() { | ||||
|     logger: getLogLevels(), | ||||
|   }); | ||||
|  | ||||
|   const listeningPort = Number(process.env.MACHINE_LEARNING_PORT) || 3002; | ||||
|  | ||||
|   const redisIoAdapter = new RedisIoAdapter(app); | ||||
|   await redisIoAdapter.connectToRedis(); | ||||
|   app.useWebSocketAdapter(redisIoAdapter); | ||||
|  | ||||
|   await app.listen(3002, () => { | ||||
|   await app.listen(listeningPort, () => { | ||||
|     const envName = (process.env.NODE_ENV || 'development').toUpperCase(); | ||||
|     logger.log(`Running Immich Microservices in ${envName} environment - version ${SERVER_VERSION}`); | ||||
|     logger.log( | ||||
|       `Running Immich Microservices in ${envName} environment - version ${SERVER_VERSION} - Listening on port: ${listeningPort}`, | ||||
|     ); | ||||
|   }); | ||||
| } | ||||
| bootstrap(); | ||||
|   | ||||
| @@ -35,5 +35,8 @@ export const immichAppConfig: ConfigModuleOptions = { | ||||
|     DISABLE_REVERSE_GEOCODING: Joi.boolean().optional().valid(true, false).default(false), | ||||
|     REVERSE_GEOCODING_PRECISION: Joi.number().optional().valid(0, 1, 2, 3).default(3), | ||||
|     LOG_LEVEL: Joi.string().optional().valid('simple', 'verbose', 'debug', 'log', 'warn', 'error').default('log'), | ||||
|     MACHINE_LEARNING_PORT: Joi.number().optional(), | ||||
|     MICROSERVICES_PORT: Joi.number().optional(), | ||||
|     SERVER_PORT: Joi.number().optional(), | ||||
|   }), | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user