Server tools to backfill, tail, mirror, and verify PLC logs

ensure certs dir exists

use tokio::fs for it in both places

+14 -8
+4 -1
src/bin/allegedly.rs
··· 1 1 use allegedly::{Dt, bin::GlobalArgs, bin_init, pages_to_stdout, pages_to_weeks, poll_upstream}; 2 2 use clap::{CommandFactory, Parser, Subcommand}; 3 3 use std::{path::PathBuf, time::Instant}; 4 + use tokio::fs::create_dir_all; 4 5 use tokio::sync::mpsc; 5 6 6 7 mod backfill; ··· 82 83 .expect("to poll upstream") 83 84 }); 84 85 log::trace!("ensuring output directory exists"); 85 - std::fs::create_dir_all(&dest).expect("to ensure output dir exists"); 86 + create_dir_all(&dest) 87 + .await 88 + .expect("to ensure output dir exists"); 86 89 pages_to_weeks(rx, dest, clobber) 87 90 .await 88 91 .expect("to write bundles to output files");
+10 -7
src/bin/mirror.rs
··· 2 2 use clap::Parser; 3 3 use reqwest::Url; 4 4 use std::{net::SocketAddr, path::PathBuf}; 5 - use tokio::sync::mpsc; 6 - use tokio::task::JoinSet; 5 + use tokio::{fs::create_dir_all, sync::mpsc, task::JoinSet}; 7 6 8 7 #[derive(Debug, clap::Args)] 9 8 pub struct Args { ··· 64 63 .expect("there to be at least one op in the db. did you backfill?"); 65 64 66 65 let listen_conf = match (bind, acme_domain.is_empty(), acme_cache_path) { 67 - (_, false, Some(cache_path)) => ListenConf::Acme { 68 - domains: acme_domain, 69 - cache_path, 70 - directory_url: acme_directory_url.to_string(), 71 - }, 66 + (_, false, Some(cache_path)) => { 67 + log::info!("configuring acme for https at {acme_domain:?}..."); 68 + create_dir_all(&cache_path).await?; 69 + ListenConf::Acme { 70 + domains: acme_domain, 71 + cache_path, 72 + directory_url: acme_directory_url.to_string(), 73 + } 74 + } 72 75 (bind, true, None) => ListenConf::Bind(bind), 73 76 (_, _, _) => unreachable!(), 74 77 };