This commit is contained in:
naskya 2024-06-25 12:25:35 +09:00
parent 00afd7e6b0
commit e1d6b77079
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
3 changed files with 17 additions and 3 deletions

View file

@ -90,6 +90,12 @@ fishctl config validate
Note that some items are only formally checked, so even if the output says it is valid, your settings may not be appropriate.
This command performs a connection check against the PostgreSQL server and the Redis/Valkey server. To turn it off, provide the `--offline` option:
```sh
fishctl config validate --offline
```
### Generate VAPID keys for push notifications
```sh

View file

@ -17,7 +17,11 @@ pub(crate) enum Commands {
/// Convert old config files to the new format
Update { revision: Option<Revision> },
/// Validate the config files
Validate,
Validate {
#[arg(short, long)]
/// Do not perform connection checks against database and cache servers
offline: bool,
},
}
/// Errors that can happen in `config` subcommand
@ -32,7 +36,7 @@ pub(crate) enum ConfigError {
pub(super) async fn run(command: Commands) -> Result<(), ConfigError> {
match command {
Commands::Update { revision } => update::run(revision).await?,
Commands::Validate => validate::run()?,
Commands::Validate { offline } => validate::run(offline)?,
}
Ok(())
}

View file

@ -19,7 +19,7 @@ pub(crate) enum ValidationError {
InvalidConfig,
}
pub(super) fn run() -> Result<(), ValidationError> {
pub(super) fn run(bypass_connection_checks: bool) -> Result<(), ValidationError> {
if current_revision()?.next().is_some() {
cprintln!("Please first run `<bold>fishctl config update</>` to update your config files.");
return Err(ValidationError::OutOfDate);
@ -66,5 +66,9 @@ pub(super) fn run() -> Result<(), ValidationError> {
cprintln!("<bold>Note:</> This command only checks the format of the config files, and its result does not guarantee the correctness of the value.");
}
if !bypass_connection_checks {
todo!()
}
server_validation_result.and(client_validation_result)
}