Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2024-12-19 23:59:22 +01:00
parent d8d393b180
commit 161c259dee
2 changed files with 10 additions and 9 deletions

View file

@ -28,11 +28,11 @@ use crate::error::Error;
use crate::hooks::Hook; use crate::hooks::Hook;
use crate::web::hooks; use crate::web::hooks;
use log::error;
use camino::Utf8PathBuf; use camino::Utf8PathBuf;
use clap::{command, value_parser, Arg}; use clap::{command, value_parser, Arg};
use hyper::{server::conn::http1, service::service_fn}; use hyper::{server::conn::http1, service::service_fn};
use hyper_util::rt::tokio::{TokioIo, TokioTimer}; use hyper_util::rt::tokio::{TokioIo, TokioTimer};
use log::error;
use tokio::{net::TcpListener, sync::mpsc}; use tokio::{net::TcpListener, sync::mpsc};
#[tokio::main] #[tokio::main]
@ -76,13 +76,14 @@ async fn main() -> Result<!, Error> {
tokio::task::spawn(async move { tokio::task::spawn(async move {
if let Err(err) = http1::Builder::new() if let Err(err) = http1::Builder::new()
.timer(TokioTimer::new()) .timer(TokioTimer::new())
.serve_connection(io, service_fn(|request| { .serve_connection(
io,
service_fn(|request| {
let value_tx = value_tx.clone(); let value_tx = value_tx.clone();
let secret = secret.clone(); let secret = secret.clone();
async move { async move { hooks(request, &secret, value_tx).await }
hooks(request, &secret, value_tx).await }),
} )
}))
.await .await
{ {
println!("Error serving connection: {:?}", err); println!("Error serving connection: {:?}", err);