From 3ed807f3277ad282c18dd51a84fe966ac053ac00 Mon Sep 17 00:00:00 2001 From: Gabriel Gordon-Hall Date: Thu, 17 Jul 2025 16:29:35 +0100 Subject: [PATCH] chore: configurable host (#247) * make host configurable * update host var name --- README.md | 3 ++- backend/src/main.rs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa3326ec..5fb7c264 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ The following environment variables can be configured at build time or runtime: | `POSTHOG_API_ENDPOINT` | Build-time | Empty | PostHog analytics endpoint (disables analytics if empty) | | `BACKEND_PORT` | Runtime | `0` (auto-assign) | Backend server port | | `FRONTEND_PORT` | Runtime | `3000` | Frontend development server port | +| `HOST` | Runtime | `127.0.0.1` | Backend server host | | `DISABLE_WORKTREE_ORPHAN_CLEANUP` | Runtime | Not set | Disable git worktree cleanup (for debugging) | **Build-time variables** must be set when running `pnpm run build`. **Runtime variables** are read when the application starts. @@ -100,4 +101,4 @@ By default, Vibe Kanban uses Bloop AI's GitHub OAuth app for authentication. To 4. Build with your client ID: ```bash GITHUB_CLIENT_ID=your_client_id_here pnpm run build - ``` \ No newline at end of file + ``` diff --git a/backend/src/main.rs b/backend/src/main.rs index d5d7ff14..992c8fc9 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -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...");