Add a "check-config" command to validate config files & tests for it

This commit is contained in:
Andreas Fuchs 2024-10-04 10:49:08 -04:00
parent 70ee206031
commit 26ba489aa3
24 changed files with 492 additions and 0 deletions

View file

@ -45,6 +45,9 @@ pub(crate) enum Main {
#[error("failed to install global default tracing subscriber")]
SetSubscriber(#[from] tracing::subscriber::SetGlobalDefaultError),
#[error(transparent)]
CheckConfigCommand(#[from] CheckConfigCommand),
}
/// Errors returned from the `serve` CLI subcommand.
@ -72,6 +75,16 @@ pub(crate) enum ServeCommand {
ServerNameChanged(#[from] ServerNameChanged),
}
/// Errors returned from the `check-config` CLI subcommand.
// Missing docs are allowed here since that kind of information should be
// encoded in the error messages themselves anyway.
#[allow(missing_docs)]
#[derive(Error, Debug)]
pub(crate) enum CheckConfigCommand {
#[error("failed to validate configuration")]
Config(#[from] Config),
}
/// Error generated if `server_name` has changed or if checking this failed
// Missing docs are allowed here since that kind of information should be
// encoded in the error messages themselves anyway.