diff --git a/src/bin/allegedly.rs b/src/bin/allegedly.rs index 9eab37e..ec4da15 100644 --- a/src/bin/allegedly.rs +++ b/src/bin/allegedly.rs @@ -1,6 +1,7 @@ use allegedly::{Dt, bin::GlobalArgs, bin_init, pages_to_stdout, pages_to_weeks, poll_upstream}; use clap::{CommandFactory, Parser, Subcommand}; use std::{path::PathBuf, time::Instant}; +use tokio::fs::create_dir_all; use tokio::sync::mpsc; mod backfill; @@ -82,7 +83,9 @@ async fn main() -> anyhow::Result<()> { .expect("to poll upstream") }); log::trace!("ensuring output directory exists"); - std::fs::create_dir_all(&dest).expect("to ensure output dir exists"); + create_dir_all(&dest) + .await + .expect("to ensure output dir exists"); pages_to_weeks(rx, dest, clobber) .await .expect("to write bundles to output files"); diff --git a/src/bin/mirror.rs b/src/bin/mirror.rs index cb81baa..570f3ec 100644 --- a/src/bin/mirror.rs +++ b/src/bin/mirror.rs @@ -2,8 +2,7 @@ use allegedly::{Db, ListenConf, bin::GlobalArgs, bin_init, pages_to_pg, poll_ups use clap::Parser; use reqwest::Url; use std::{net::SocketAddr, path::PathBuf}; -use tokio::sync::mpsc; -use tokio::task::JoinSet; +use tokio::{fs::create_dir_all, sync::mpsc, task::JoinSet}; #[derive(Debug, clap::Args)] pub struct Args { @@ -64,11 +63,15 @@ pub async fn run( .expect("there to be at least one op in the db. did you backfill?"); let listen_conf = match (bind, acme_domain.is_empty(), acme_cache_path) { - (_, false, Some(cache_path)) => ListenConf::Acme { - domains: acme_domain, - cache_path, - directory_url: acme_directory_url.to_string(), - }, + (_, false, Some(cache_path)) => { + log::info!("configuring acme for https at {acme_domain:?}..."); + create_dir_all(&cache_path).await?; + ListenConf::Acme { + domains: acme_domain, + cache_path, + directory_url: acme_directory_url.to_string(), + } + } (bind, true, None) => ListenConf::Bind(bind), (_, _, _) => unreachable!(), };