chore: configurable host (#247)

* make host configurable

* update host var name
This commit is contained in:
Gabriel Gordon-Hall
2025-07-17 16:29:35 +01:00
committed by GitHub
parent ddc692fa77
commit 3ed807f327
2 changed files with 5 additions and 3 deletions

View File

@@ -233,10 +233,11 @@ fn main() -> anyhow::Result<()> {
0
}); // Use 0 to find free port if no specific port provided
let listener = tokio::net::TcpListener::bind(format!("127.0.0.1:{port}")).await?;
let host = std::env::var("HOST").unwrap_or_else(|_| "127.0.0.1".to_string());
let listener = tokio::net::TcpListener::bind(format!("{host}:{port}")).await?;
let actual_port = listener.local_addr()?.port(); // get → 53427 (example)
tracing::info!("Server running on http://127.0.0.1:{actual_port}");
tracing::info!("Server running on http://{host}:{actual_port}");
if !cfg!(debug_assertions) {
tracing::info!("Opening browser...");