wip: add export subcommand

Currently exports:

* Server name
* PDUs
* Public signing keys
This commit is contained in:
Charles Hall 2025-03-03 22:09:22 -08:00
parent adb174d985
commit 2ff415a562
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 441 additions and 0 deletions

View file

@ -13,6 +13,7 @@ use crate::{
};
mod check_config;
mod export;
mod serve;
/// Command line arguments
@ -33,6 +34,9 @@ pub(crate) enum Command {
/// Check the configuration file for syntax and semantic errors.
CheckConfig(CheckConfigArgs),
/// Export all persistent data.
Export(ExportArgs),
}
#[derive(clap::Args)]
@ -44,6 +48,18 @@ pub(crate) struct CheckConfigArgs {
observability: ObservabilityArgs,
}
#[derive(clap::Args)]
pub(crate) struct ExportArgs {
#[clap(flatten)]
config: ConfigArg,
#[clap(flatten)]
observability: ObservabilityArgs,
#[clap(short, long)]
out_dir: PathBuf,
}
/// Wrapper for the `--config` arg.
///
/// This exists to centralize the `mut_arg` code that sets the help value based
@ -99,6 +115,9 @@ impl Args {
Command::CheckConfig(args) => {
check_config::run(args.config).await?;
}
Command::Export(args) => {
export::run(args).await?;
}
}
Ok(())
}
@ -113,6 +132,10 @@ impl Command {
args.observability.log_format,
args.observability.log_filter.clone(),
)),
Command::Export(args) => Some((
args.observability.log_format,
args.observability.log_filter.clone(),
)),
Command::Serve(_) => None,
}
}