From 797fafe854a5f91690aaa2e62cd9029057962e16 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Tue, 25 Nov 2025 00:52:46 +0000 Subject: [PATCH] Normalize host when parsing CLI --- packages/server/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 5ef50c1e..7c29c87d 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -80,9 +80,11 @@ function parseCliOptions(argv: string[]): CliOptions { const resolvedRoot = parsed.workspaceRoot ?? parsed.root ?? process.cwd() + const normalizedHost = resolveHost(parsed.host) + return { port: parsed.port, - host: parsed.host, + host: normalizedHost, rootDir: resolvedRoot, configPath: parsed.config, unrestrictedRoot: Boolean(parsed.unrestrictedRoot), @@ -102,6 +104,13 @@ function parsePort(input: string): number { return value } +function resolveHost(input: string | undefined): string { + if (input && input.trim() === "0.0.0.0") { + return "0.0.0.0" + } + return DEFAULT_HOST +} + async function main() { const options = parseCliOptions(process.argv.slice(2)) const logger = createLogger({ level: options.logLevel, destination: options.logDestination, component: "app" })