From c643a59e29db0b66cd0a65d18fef3b36c0f14ca2 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Sun, 25 Jan 2026 22:42:15 -0300 Subject: [PATCH] config: use production URL as default when BOTSERVER_ENV=production --- src/core/config/mod.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index 1fbefed88..8d118bb9e 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -294,7 +294,16 @@ impl AppConfig { server: ServerConfig { host: get_str("server_host", "0.0.0.0"), port: get_u16("server_port", 8080), - base_url: get_str("server_base_url", "http://localhost:8080"), + base_url: config_map.get("server_base_url").cloned().unwrap_or_else(|| { + let is_prod = std::env::var("BOTSERVER_ENV") + .map(|v| v == "production" || v == "prod") + .unwrap_or(false); + if is_prod { + "https://system.pragmatismo.com.br/".to_string() + } else { + "http://localhost:8080".to_string() + } + }), }, site_path: { ConfigManager::new(pool.clone()).get_config( @@ -327,7 +336,16 @@ impl AppConfig { server: ServerConfig { host: "0.0.0.0".to_string(), port: 8080, - base_url: "http://localhost:8080".to_string(), + base_url: { + let is_prod = std::env::var("BOTSERVER_ENV") + .map(|v| v == "production" || v == "prod") + .unwrap_or(false); + if is_prod { + "https://system.pragmatismo.com.br/".to_string() + } else { + "http://localhost:8080".to_string() + } + }, }, site_path: "./botserver-stack/sites".to_string(),