From 84458b2a6905af7db72b15f5e833bb7942ccdaa9 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Fri, 6 Feb 2026 12:56:52 -0300 Subject: [PATCH] feat: Add BOTSERVER_PORT environment variable override - Check BOTSERVER_PORT env var before database config - Override server_port from database if BOTSERVER_PORT is set - Apply to both from_database() and from_env() config paths - Allows easy port configuration via environment variable --- src/core/config/mod.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index 69c14bce5..26dd403d5 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -288,12 +288,17 @@ impl AppConfig { smtp_server: get_str("EMAIL_SMTP_SERVER", "smtp.gmail.com"), smtp_port: get_u16("EMAIL_SMTP_PORT", 587), }; + let port = std::env::var("BOTSERVER_PORT") + .ok() + .and_then(|v| v.parse::().ok()) + .unwrap_or_else(|| get_u16("server_port", 8080)); + Ok(Self { drive, email, server: ServerConfig { host: get_str("server_host", "0.0.0.0"), - port: get_u16("server_port", 8080), + port, base_url: config_map.get("server_base_url").cloned().unwrap_or_else(|| "http://localhost:8080".to_string()), }, site_path: { @@ -321,12 +326,17 @@ impl AppConfig { smtp_server: "smtp.gmail.com".to_string(), smtp_port: 587, }; + let port = std::env::var("BOTSERVER_PORT") + .ok() + .and_then(|v| v.parse::().ok()) + .unwrap_or(8080); + Ok(Self { drive: minio, email, server: ServerConfig { host: "0.0.0.0".to_string(), - port: 8080, + port, base_url: "http://localhost:8080".to_string(), },