Zeitpunkt Nutzer Delta Tröts TNR Titel Version maxTL Sa 06.07.2024 00:00:07 61.917 -2 3.523.632 56,9 Fosstodon 4.2.10 500 Fr 05.07.2024 00:00:27 61.919 0 3.520.710 56,9 Fosstodon 4.2.10 500 Do 04.07.2024 00:00:52 61.919 +2 3.517.337 56,8 Fosstodon 4.2.9 500 Mi 03.07.2024 00:00:12 61.917 +2 3.513.906 56,8 Fosstodon 4.2.9 500 Di 02.07.2024 00:01:44 61.915 -2 3.510.479 56,7 Fosstodon 4.2.9 500 Mo 01.07.2024 00:00:33 61.917 0 3.507.420 56,6 Fosstodon 4.2.9 500 So 30.06.2024 00:00:34 61.917 +2 3.504.671 56,6 Fosstodon 4.2.9 500 Sa 29.06.2024 00:01:13 61.915 +2 3.501.982 56,6 Fosstodon 4.2.9 500 Fr 28.06.2024 00:01:07 61.913 +3 3.498.459 56,5 Fosstodon 4.2.9 500 Do 27.06.2024 00:00:32 61.910 0 3.495.444 56,5 Fosstodon 4.2.9 500
Stefan Mayrhofer (@smayrh) · 05/2023 · Tröts: 47 · Folger: 13
Sa 06.07.2024 01:41
Built a simple new site at https://smayrh.dev with the leptos-axum template and used the rustls_acme crate to manage #LetsEncrypt certs with just a few lines of code in async fn main(). This just works and no external tools are needed.
I could ditch tokio::net::TcpListener for std::net::TcpListener, not convert it, but I'm still in denial about this axum call not supporting tokio 🙈
BTW, Website logo made with 1989's Banner Mania for #MSDOS.
#Leptos #Axum #RustLang #WebDev #TLS #HTTPS
logging::log!("event: {:?}", ok), Err(err) => logging::log!("error: {:?}", err), } } });" title="//! top of async fn main() in main.rs // Certificate Management use rustls_acme::caches::DirCache; use rustls_acme::AcmeConfig; use tokio_stream::StreamExt; let mut state = AcmeConfig::new(["smayrh.dev"]) .contact_push("mailto:REDACTED@REDACTED") .cache(DirCache::new("/REDACTED/acme")) .directory_lets_encrypt(true) .state(); let acceptor = state.axum_acceptor(state.default_rustls_config()); tokio::spawn(async move { loop { match state.next().await.unwrap() { Ok(ok) => logging::log!("event: {:?}", ok), Err(err) => logging::log!("error: {:?}", err), } } });"
//! top of async fn main() in main.rs // Certificate Management use rustls_acme::caches::DirCache; use rustls_acme::AcmeConfig; use tokio_stream::StreamExt; let mut state = AcmeConfig::new(["smayrh.dev"]) .contact_push("mailto:REDACTED@REDACTED") .cache(DirCache::new("/REDACTED/acme")) .directory_lets_encrypt(true) .state(); let acceptor = state.axum_acceptor(state.default_rustls_config()); tokio::spawn(async move { loop { match state.next().await.unwrap() { Ok(ok) => logging::log!("event: {:?}", ok), Err(err) => logging::log!("error: {:?}", err), } } });
//! bottom of async fn main() in main.rs let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); logging::log!("listening on http://{}", &addr); // original leptos-axum variant to invoke server // axum::serve(listener, app.into_make_service()) // .await // .unwrap(); // this variant allows the use of a TLS acceptor axum_server::from_tcp(listener.into_std().unwrap()) .acceptor(acceptor) .serve(app.into_make_service()) .await .unwrap(); }
[Öffentlich] Antw.: 0 Wtrl.: 0 Fav.: 0