bump various deps (except for the HTTP libs currently), use my

rust-rocksdb fork, add optional opt-in zstd response body compression
config, add webp support for images

cant upgrade things like axum, http, tower, hyper, etc due to the 1.0
release of http which are breaking all of these libs

Signed-off-by: strawberry <strawberry@pupbrain.dev>
This commit is contained in:
strawberry 2023-11-25 01:30:19 -05:00
parent 3533645959
commit 87d1040386
6 changed files with 222 additions and 106 deletions

View file

@ -106,6 +106,10 @@ pub struct Config {
#[serde(default = "default_presence_offline_timeout_s")]
pub presence_offline_timeout_s: u64,
#[cfg(feature = "zstd_compression")]
#[serde(default = "false_fn")]
pub zstd_compression: bool,
#[serde(flatten)]
pub catchall: BTreeMap<String, IgnoredAny>,
}
@ -248,6 +252,10 @@ impl fmt::Display for Config {
}
&lst.join(", ")
}),
(
"zstd Response Body Compression",
&self.zstd_compression.to_string(),
),
];
let mut msg: String = "Active config values:\n\n".to_owned();

View file

@ -205,7 +205,16 @@ async fn run_server() -> io::Result<()> {
.expect("failed to convert max request size"),
));
let app = routes().layer(middlewares).into_make_service();
let app: axum::routing::IntoMakeService<Router>;
if cfg!(feature = "zstd_compression") && config.zstd_compression == true {
debug!("zstd body compression is enabled");
app = routes()
.layer(middlewares.compression())
.into_make_service();
} else {
app = routes().layer(middlewares).into_make_service();
}
let handle = ServerHandle::new();
let (tx, rx) = oneshot::channel::<()>();