fix building without serve feature

This commit is contained in:
zyl 2024-11-08 18:23:18 -08:00
parent 399a0c1b87
commit 0d9c48db40
Signed by: zyl
SSH key fingerprint: SHA256:uxxbSXbdroP/OnKBGnEDk5q7EKB2razvstC/KmzdXXs

View file

@ -91,8 +91,7 @@ enum ResourceCommands {
}, },
} }
#[tokio::main] fn main() -> eyre::Result<()> {
async fn main() -> eyre::Result<()> {
#[cfg(feature = "color-eyre")] #[cfg(feature = "color-eyre")]
color_eyre::install()?; color_eyre::install()?;
@ -136,7 +135,8 @@ async fn main() -> eyre::Result<()> {
#[cfg(feature = "serve")] #[cfg(feature = "serve")]
Commands::Serve { ip, port } => { Commands::Serve { ip, port } => {
let site = site()?; let site = site()?;
site.serve(&format!("{}:{}", ip, port)).await let rt = tokio::runtime::Runtime::new()?;
rt.block_on(async move { site.serve(&format!("{}:{}", ip, port)).await })
} }
Commands::Now => { Commands::Now => {
let time = OffsetDateTime::now_utc(); let time = OffsetDateTime::now_utc();