From fee897632bd2b3f833503a0e3716e2ff2f1a406a Mon Sep 17 00:00:00 2001 From: Jan <59206115+Threated@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:46:59 +0200 Subject: [PATCH] chore: port http ecosystem to hyper 1 (#33) --- Cargo.toml | 17 ++++++++--------- src/main.rs | 5 ++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a1bf2f7..dcaf132 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,12 +8,11 @@ documentation = "https://github.com/samply/spot" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -axum = "0.6.12" -#axum-macros = "0.3.7" -clap = { version = "4.2.1", features = ["env", "derive"] } -serde = { version = "1.0.159", features = ["serde_derive"] } -serde_json = "1.0.96" -tokio = { version = "1.27.0", features = ["full"] } +axum = "0.7" +clap = { version = "4", features = ["env", "derive"] } +serde = { version = "1", features = ["serde_derive"] } +serde_json = "1" +tokio = { version = "1", features = ["full"] } beam-lib = { git = "https://github.com/samply/beam", branch = "develop", features=["http-util"] } once_cell = "1" async-sse = "5.1" @@ -22,11 +21,11 @@ futures-util = { version = "0.3", default-features = false, features = ["std", " # Logging tracing = "0.1.37" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } -reqwest = { version = "0.11.20", default-features = false, features = ["stream", "default-tls"] } -tower-http = { version = "0.4.4", features = ["cors"] } +reqwest = { version = "0.12", default-features = false, features = ["stream", "default-tls"] } +tower-http = { version = "0.5", features = ["cors"] } [build-dependencies] -build-data = "0.1.4" +build-data = "0.2.1" [profile.release] #opt-level = "z" # Optimize for size. diff --git a/src/main.rs b/src/main.rs index 1a98dd5..458af91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ use serde_json::Value; use tower_http::cors::CorsLayer; use tracing::{info, warn, Level}; use tracing_subscriber::{util::SubscriberInitExt, EnvFilter}; -use tokio::{io::AsyncWriteExt, sync::{mpsc, Mutex}}; +use tokio::{io::AsyncWriteExt, net::TcpListener, sync::{mpsc, Mutex}}; use futures_util::{TryFutureExt, TryStreamExt}; use health::{BeamStatus, HealthOutput, Verdict}; @@ -88,8 +88,7 @@ async fn main() { banner::print_banner(); - axum::Server::bind(&CONFIG.bind_addr) - .serve(app.into_make_service()) + axum::serve(TcpListener::bind(CONFIG.bind_addr).await.unwrap(), app.into_make_service()) .await .unwrap(); }