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" })