Skip to content

Add --host flag to control server bind address#1

Merged
abien merged 2 commits into
mainfrom
copilot/make-app-bind-to-0-0-0
Mar 4, 2026
Merged

Add --host flag to control server bind address#1
abien merged 2 commits into
mainfrom
copilot/make-app-bind-to-0-0-0

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 4, 2026

The server hardcoded localhost as its bind address, making it unreachable from outside the local machine — a problem for WSL2 users who need to access the dashboard from a Windows browser.

Changes

  • src/server/cli.ts: Added host: string to CLIFlags (default: "localhost"), --host <address> argument parsing with basic character validation, and updated help text with example.
  • src/server/index.ts: Passes hostname to the Bun server export. When --host 0.0.0.0, switches CORS to origin: "*" (specific origins are meaningless for an all-interfaces bind); otherwise preserves the existing specific-origin CORS. Startup log normalizes 0.0.0.0localhost so the printed URL remains clickable.
  • README.md: Documents the new flag in the options table.

Usage

# Bind to all interfaces — reachable from Windows browser via WSL2 IP
ocwatch --host 0.0.0.0

# Bind to a specific interface
ocwatch --host 192.168.1.100

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: abien <254409+abien@users.noreply.github.com>
Copilot AI changed the title [WIP] Add parameter to bind app to 0.0.0.0 at startup Add --host flag to control server bind address Mar 4, 2026
Copilot finished work on behalf of abien March 4, 2026 13:37
@abien abien marked this pull request as ready for review March 4, 2026 13:41
@abien abien merged commit 2c8d596 into main Mar 4, 2026
@abien abien deleted the copilot/make-app-bind-to-0-0-0 branch March 4, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants