From 70a167d34a1103dcb3d516d6101bae08ef274591 Mon Sep 17 00:00:00 2001 From: chaos Date: Wed, 27 Sep 2023 21:18:15 +0100 Subject: [PATCH] re-add compatibility with only UDS set --- src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index b752dff..0bd4c7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,9 +25,12 @@ async fn main() -> std::io::Result<()> { // match all requests App::new().default_service(web::to(index)) }); - // get port from env - if let Ok(unix_socket) = env::var("BIND_UNIX") { - server.bind_uds(unix_socket)? + + // get socket/port from env + // backwards compat when only UDS is set + let socket_path = env::var("BIND_UNIX").unwrap_or_else(|_| "./socket/actix.sock".to_string()); + if env::var("UDS").is_ok() { + server.bind_uds(socket_path)? } else { let bind = env::var("BIND").unwrap_or_else(|_| "0.0.0.0:8080".to_string()); server.bind(bind)?