From fe9562b59620f7887ee6494336d27a60ee507782 Mon Sep 17 00:00:00 2001 From: Josef Date: Tue, 11 Nov 2025 10:35:13 +0100 Subject: [PATCH] Set host in Fastify --- node/users/UserManagementServer.ts | 14 ++++++++++++-- node/users/UserManagementServerSettings.ts | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/node/users/UserManagementServer.ts b/node/users/UserManagementServer.ts index 49f20c1..5da311a 100644 --- a/node/users/UserManagementServer.ts +++ b/node/users/UserManagementServer.ts @@ -1,4 +1,4 @@ -import Fastify, { FastifyInstance } from "fastify"; +import Fastify, { FastifyInstance, FastifyListenOptions } from "fastify"; import fastifyMultipart from "@fastify/multipart"; import cors from '@fastify/cors'; @@ -150,9 +150,19 @@ export class UserManagementServer async _startServer() { + let listenOptions:FastifyListenOptions = + { + port: this._settings.port + } + + if ( ! this._settings.isDebugMode ) + { + listenOptions.host = "0.0.0.0"; + } + this.app.listen( - { port: this._settings.port }, + listenOptions, ( error, address ) => { diff --git a/node/users/UserManagementServerSettings.ts b/node/users/UserManagementServerSettings.ts index 31d7699..808bf29 100644 --- a/node/users/UserManagementServerSettings.ts +++ b/node/users/UserManagementServerSettings.ts @@ -7,6 +7,7 @@ export class UserManagementServerSettings url:string; port:number = 8084; corsURLs:string[] = []; + isDebugMode:boolean = false; // Paths rootPath:string;