From 00d15fe43b05504f3d3f8e3612bd50f894cc4d5c Mon Sep 17 00:00:00 2001 From: Kristof Vandam Date: Fri, 22 Mar 2024 17:04:08 +0100 Subject: [PATCH] allow to listen on unix domain sockets --- meilisearch/src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meilisearch/src/main.rs b/meilisearch/src/main.rs index af02f58e1..9b6a71382 100644 --- a/meilisearch/src/main.rs +++ b/meilisearch/src/main.rs @@ -153,7 +153,11 @@ async fn run_http( if let Some(config) = opt_clone.get_ssl_config()? { http_server.bind_rustls_021(opt_clone.http_addr, config)?.run().await?; } else { - http_server.bind(&opt_clone.http_addr)?.run().await?; + if opt_clone.http_addr.starts_with("/") { + http_server.bind_uds(&opt_clone.http_addr)?.run().await? + } else { + http_server.bind(&opt_clone.http_addr)?.run().await? + } } Ok(()) } @@ -166,7 +170,13 @@ pub fn print_launch_resume( let build_info = build_info::BuildInfo::from_build(); let protocol = - if opt.ssl_cert_path.is_some() && opt.ssl_key_path.is_some() { "https" } else { "http" }; + if opt.ssl_cert_path.is_some() && opt.ssl_key_path.is_some() { + "https" + } else if opt.http_addr.starts_with("/") { + "unix" + } else { + "http" + }; let ascii_name = r#" 888b d888 d8b 888 d8b 888 8888b d8888 Y8P 888 Y8P 888