Repository navigation
feat(cli): configurable bind host (--host flag + config host field) - #5
Conversation
Server previously hardcoded 127.0.0.1. Multi-host/container deployments had to recompile to change the bind address. - Config.host (JSON config, default 127.0.0.1, empty falls back to default) - --host CLI flag; precedence CLI > config file > default, mirroring --port - listen/log messages include the resolved host - tests: default host, config-file host parse, host-unset keeps default
vernonstinebaker
left a comment
There was a problem hiding this comment.
Clean, minimal, and convention-consistent: host config field (default 127.0.0.1 — zero behavior change unless explicitly configured) + --host CLI override, matching nullboiler's flag style. Tests cover default, override, and unset cases. Note: this branch predates #9's test wiring, so its CI ran an empty suite — after merge, main's 18+ test suite covers it (and these host tests will actually execute for the first time). Merging.
|
Merged — but heads-up: the textual auto-merge spliced this PR's new test onto #9's refactored test region in |
What
Bind address was hardcoded to
127.0.0.1. This adds:Config.hostJSON field (default127.0.0.1; empty value falls back to default)--host <addr>CLI flag--host> config filehost> default — mirrors the existing--portbehaviorWhy
Multi-host and container deployments (e.g. reaching the server from another host or a container bridge) previously required a recompile to change the bind address.
--portwas already configurable;--hostwas the missing half.Validation
zig buildcleanzig build testgreen (new tests: default host, config-file host parse, host-unset keeps default)nulltickets --host 127.0.0.2 --port 7799binds and serves/healthon the given addressNo behavior change for existing deployments: without
--hostand without a confighostkey, the server still binds127.0.0.1.