Files
ottyl/tickets/019-default-port-zero.md
T

1.1 KiB

019 — Default port should be 0

Summary

--port currently defaults to 8420 (Args in main.rs). The wishlist asks for a default of 0, i.e. let the OS assign an ephemeral free port rather than colliding with whatever else is running on a fixed port.

Scope

  • Change Args::port's default to 0.
  • After TcpListener::bind succeeds, read back the actual bound port (via listener.local_addr()) since binding to 0 means the requested port and the real one differ.
  • Print the real bound port in the startup log line (it already prints args.port, which would otherwise always read 0).
  • Consider whether the actual port needs to be surfaced anywhere else (e.g. a GET /api/stats-style endpoint) — not required unless something already depends on knowing it programmatically today; check before adding.

Acceptance criteria

  • Running ottyl with no --port binds an OS-assigned free port instead of a fixed one, and the startup message prints that actual port.
  • --port <n> still binds the requested fixed port as before.

Depends on

None.