diff --git a/actix/src/main.rs b/actix/src/main.rs index da27c68..5d41a4e 100644 --- a/actix/src/main.rs +++ b/actix/src/main.rs @@ -47,11 +47,10 @@ async fn main() -> Result<()> { } // Tell the user that the server has started, and where it is listening to, rather than simply outputting nothing - eprintln!( - "Server has started at 0.0.0.0 on port {}. Configured Site URL is: {}", - port, - env::var("site_url").unwrap_or(String::from("http://localhost")) - ); + eprintln!("Server has started at 0.0.0.0 on port {port}."); + if let Some(site_url) = env::var("site_url").ok().filter(|s| !s.trim().is_empty()) { + eprintln!("Configured Site URL is: {site_url}."); + } // Actually start the server HttpServer::new(move || { diff --git a/actix/src/services.rs b/actix/src/services.rs index 4a10d4d..a5c80db 100644 --- a/actix/src/services.rs +++ b/actix/src/services.rs @@ -61,7 +61,10 @@ pub async fn add_link( .expect("Supplied port is not an integer"); let url = format!( "{}:{}", - env::var("site_url").unwrap_or(String::from("http://localhost")), + env::var("site_url") + .ok() + .filter(|s| !s.trim().is_empty()) + .unwrap_or(String::from("http://localhost")), port ); let response = CreatedURL {