diff --git a/src/main.rs b/src/main.rs index 1af34f9..a054f24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,12 +62,11 @@ async fn main() -> Result { ); let tcp_bind = TcpListener::bind(config.addr).await?; - let secret: &'static String = - unsafe { core::mem::transmute::<&String, &'static String>(&config.secret) }; let value_tx = Arc::new(Mutex::new(value_tx)); loop { let value_tx = value_tx.clone(); + let secret = config.secret.clone(); tokio::select! { _ = client.next() => (), @@ -79,8 +78,9 @@ async fn main() -> Result { .timer(TokioTimer::new()) .serve_connection(io, service_fn(|request| { let value_tx = value_tx.clone(); + let secret = secret.clone(); async move { - hooks(request, secret, value_tx).await + hooks(request, &secret, value_tx).await } })) .await