fix(server): default host binding (#9090)

This commit is contained in:
Jason Rasmussen 2024-04-26 02:02:19 -04:00 committed by GitHub
parent 1d15cfb5f3
commit 69f8bfe874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,10 +14,11 @@ import { ApiService } from 'src/services/api.service';
import { otelSDK } from 'src/utils/instrumentation';
import { useSwagger } from 'src/utils/misc';
const host = process.env.HOST;
async function bootstrapMicroservices() {
otelSDK.start();
const host = String(process.env.HOST || '0.0.0.0');
const port = Number(process.env.MICROSERVICES_PORT) || 3002;
const app = await NestFactory.create(MicroservicesModule, { bufferLogs: true });
const logger = await app.resolve(ILoggerRepository);
@ -25,7 +26,7 @@ async function bootstrapMicroservices() {
app.useLogger(logger);
app.useWebSocketAdapter(new WebSocketAdapter(app));
await app.listen(port, host);
await (host ? app.listen(port, host) : app.listen(port));
logger.log(`Immich Microservices is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
}
@ -33,7 +34,6 @@ async function bootstrapMicroservices() {
async function bootstrapApi() {
otelSDK.start();
const host = String(process.env.HOST || '0.0.0.0');
const port = Number(process.env.SERVER_PORT) || 3001;
const app = await NestFactory.create<NestExpressApplication>(ApiModule, { bufferLogs: true });
const logger = await app.resolve(ILoggerRepository);
@ -69,7 +69,7 @@ async function bootstrapApi() {
}
app.use(app.get(ApiService).ssr(excludePaths));
const server = await app.listen(port, host);
const server = await (host ? app.listen(port, host) : app.listen(port));
server.requestTimeout = 30 * 60 * 1000;
logger.log(`Immich Server is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);