From 01a496988315c620a1b6cd75cf704a80d55fbf99 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Wed, 11 Mar 2026 11:00:13 +0100 Subject: [PATCH] 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. --- crates/weft-appd/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/weft-appd/src/main.rs b/crates/weft-appd/src/main.rs index 186b3f4..03b6293 100644 --- a/crates/weft-appd/src/main.rs +++ b/crates/weft-appd/src/main.rs @@ -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]);