chore: update dependencies

concurrent-repos
Jef Roosens 2024-05-19 09:47:39 +02:00
parent 9963cff724
commit e684cfb84e
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
4 changed files with 751 additions and 634 deletions

1362
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ authors = ["Jef Roosens"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
axum = { version = "0.6.18", features = ["http2"] } axum = { version = "0.7.5", features = ["http2"] }
chrono = { version = "0.4.26", features = ["serde"] } chrono = { version = "0.4.26", features = ["serde"] }
clap = { version = "4.3.12", features = ["env", "derive"] } clap = { version = "4.3.12", features = ["env", "derive"] }
futures = "0.3.28" futures = "0.3.28"
@ -18,7 +18,7 @@ sha256 = "1.1.4"
tokio = { version = "1.29.1", features = ["full"] } tokio = { version = "1.29.1", features = ["full"] }
tokio-util = { version = "0.7.8", features = ["io"] } tokio-util = { version = "0.7.8", features = ["io"] }
tower = { version = "0.4.13", features = ["make"] } tower = { version = "0.4.13", features = ["make"] }
tower-http = { version = "0.4.1", features = ["fs", "trace", "auth"] } tower-http = { version = "0.5.2", features = ["fs", "trace", "auth"] }
tracing = "0.1.37" tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
uuid = { version = "1.4.0", features = ["v4"] } uuid = { version = "1.4.0", features = ["v4"] }

View File

@ -101,12 +101,11 @@ impl Cli {
.with_state(global) .with_state(global)
.layer(TraceLayer::new_for_http()); .layer(TraceLayer::new_for_http());
let domain: String = format!("0.0.0.0:{}", self.port).parse().unwrap();
let listener = tokio::net::TcpListener::bind(domain).await?;
// run it with hyper on localhost:3000 // run it with hyper on localhost:3000
Ok( Ok(axum::serve(listener, app.into_make_service())
axum::Server::bind(&format!("0.0.0.0:{}", self.port).parse().unwrap())
.serve(app.into_make_service())
.await .await
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?, .map_err(|err| io::Error::new(io::ErrorKind::Other, err))?)
)
} }
} }

View File

@ -5,8 +5,8 @@ pub use manager::RepoGroupManager;
use std::path::PathBuf; use std::path::PathBuf;
use axum::body::Body; use axum::body::{Body, BodyDataStream};
use axum::extract::{BodyStream, Path, State}; use axum::extract::{Path, State};
use axum::http::Request; use axum::http::Request;
use axum::http::StatusCode; use axum::http::StatusCode;
use axum::response::IntoResponse; use axum::response::IntoResponse;
@ -98,13 +98,15 @@ async fn get_file(
async fn post_package_archive( async fn post_package_archive(
State(global): State<crate::Global>, State(global): State<crate::Global>,
Path(repo): Path<String>, Path(repo): Path<String>,
mut body: BodyStream, body: Body,
) -> crate::Result<()> { ) -> crate::Result<()> {
// We first stream the uploaded file to disk // We first stream the uploaded file to disk
let uuid: uuid::fmt::Simple = Uuid::new_v4().into(); let uuid: uuid::fmt::Simple = Uuid::new_v4().into();
let path = global.config.pkg_dir.join(uuid.to_string()); let path = global.config.pkg_dir.join(uuid.to_string());
let mut f = fs::File::create(&path).await?; let mut f = fs::File::create(&path).await?;
let mut body = body.into_data_stream();
while let Some(chunk) = body.next().await { while let Some(chunk) = body.next().await {
f.write_all(&chunk?).await?; f.write_all(&chunk?).await?;
} }