Start of streaming shiz
parent
828ee6c533
commit
910711a0f0
|
@ -180,6 +180,17 @@ version = "0.3.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
|
checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-macro"
|
||||||
|
version = "0.3.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-sink"
|
name = "futures-sink"
|
||||||
version = "0.3.21"
|
version = "0.3.21"
|
||||||
|
@ -199,9 +210,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
|
checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
"futures-macro",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"pin-utils",
|
"pin-utils",
|
||||||
|
"slab",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -627,9 +640,11 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-compression",
|
"async-compression",
|
||||||
"axum",
|
"axum",
|
||||||
|
"futures-util",
|
||||||
"hyper",
|
"hyper",
|
||||||
"tar",
|
"tar",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
|
|
@ -15,3 +15,5 @@ tracing-subscriber = {version = "0.3.9", features = ["env-filter"] }
|
||||||
tower-http = { version = "0.2.5", features = ["fs", "trace", "auth"] }
|
tower-http = { version = "0.2.5", features = ["fs", "trace", "auth"] }
|
||||||
tar = "0.4.38"
|
tar = "0.4.38"
|
||||||
async-compression = { version = "0.3.12", features = ["tokio", "gzip"] }
|
async-compression = { version = "0.3.12", features = ["tokio", "gzip"] }
|
||||||
|
tokio-util = { version = "0.7.1", features = ["io"] }
|
||||||
|
futures-util = "0.3.21"
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -5,9 +5,12 @@ use axum::{
|
||||||
routing::{get_service, post},
|
routing::{get_service, post},
|
||||||
Router,
|
Router,
|
||||||
};
|
};
|
||||||
|
use futures_util::TryStreamExt;
|
||||||
use hyper::{Body, Request};
|
use hyper::{Body, Request};
|
||||||
|
use std::io::ErrorKind;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use tar::Archive;
|
use tar::Archive;
|
||||||
|
use tokio_util::io::StreamReader;
|
||||||
use tower_http::{auth::RequireAuthorizationLayer, services::ServeDir, trace::TraceLayer};
|
use tower_http::{auth::RequireAuthorizationLayer, services::ServeDir, trace::TraceLayer};
|
||||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
|
|
||||||
|
@ -54,9 +57,10 @@ async fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn post_deploy(body: BodyStream) {
|
async fn post_deploy(res: BodyStream) {
|
||||||
// let tar = GzDecoder::new(body);
|
let mut read =
|
||||||
let tar = GzipDecoder::new(body);
|
StreamReader::new(res.map_err(|axum_err| std::io::Error::new(ErrorKind::Other, axum_err)));
|
||||||
let mut archive = Archive::new(tar);
|
// let tar = GzipDecoder::new(body);
|
||||||
archive.unpack("./static").unwrap();
|
// let mut archive = Archive::new(tar);
|
||||||
|
// archive.unpack("./static").unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue