diff --git a/Cargo.lock b/Cargo.lock index 75c52fb..11fd0bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -404,7 +404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "flodgatt" -version = "0.4.4" +version = "0.4.5" dependencies = [ "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 229da5d..e10ef51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "flodgatt" description = "A blazingly fast drop-in replacement for the Mastodon streaming api server" -version = "0.4.4" +version = "0.4.5" authors = ["Daniel Long Sockwell "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 6a7a074..2ea8cff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use flodgatt::{ - config, dbg_and_die, err, + config, err, parse_client_request::{sse, user, ws}, redis_to_client_stream::{self, ClientAgent}, }; @@ -89,8 +89,12 @@ fn main() { let health = warp::path!("api" / "v1" / "streaming" / "health").map(|| "OK"); - if let Some(_socket) = cfg.unix_socket.0.as_ref() { - dbg_and_die!("Unix socket support not yet implemented"); + if let Some(socket) = &*cfg.unix_socket { + warn!("Using Unix sockets is a WIP that is currently unsupported and untested."); + std::fs::remove_file(socket).unwrap(); + use tokio::net::UnixListener; + let incoming = UnixListener::bind(socket).unwrap().incoming(); + warp::serve(health.or(websocket_routes.or(sse_routes).with(cors))).run_incoming(incoming); } else { warp::serve(health.or(websocket_routes.or(sse_routes).with(cors))).run(server_addr); }