fix(appd): write actual bound WebSocket port to appd.wsport file

ws_listener.local_addr().port() is used instead of the configured
ws_port value. This is correct when WEFT_APPD_WS_PORT=0 lets the OS
assign an ephemeral port; the file reflects the real listening port.
This commit is contained in:
Marco Allegretti 2026-03-11 11:00:13 +01:00
parent 5bd4857a67
commit 01a4969883

View file

@ -126,8 +126,9 @@ async fn run() -> anyhow::Result<()> {
let ws_listener = tokio::net::TcpListener::bind(ws_addr)
.await
.with_context(|| format!("bind WebSocket {ws_addr}"))?;
tracing::info!(addr = %ws_addr, "WebSocket listener ready");
write_ws_port(ws_port)?;
let ws_bound_port = ws_listener.local_addr()?.port();
tracing::info!(port = ws_bound_port, "WebSocket listener ready");
write_ws_port(ws_bound_port)?;
let _ = sd_notify::notify(false, &[sd_notify::NotifyState::Ready]);