Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-11-22 05:10:29 +01:00
validate cron expressions on startup
Dieser Commit ist enthalten in:
Ursprung
870f0d0932
Commit
ed24d51d3e
1 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen
|
@ -1,6 +1,7 @@
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
|
|
||||||
|
use job_scheduler_ng::Schedule;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
|
|
||||||
|
@ -737,6 +738,26 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
|
||||||
err!("`INVITATION_EXPIRATION_HOURS` has a minimum duration of 1 hour")
|
err!("`INVITATION_EXPIRATION_HOURS` has a minimum duration of 1 hour")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !cfg.send_purge_schedule.is_empty() && cfg.send_purge_schedule.parse::<Schedule>().is_err() {
|
||||||
|
err!("`SEND_PURGE_SCHEDULE` is not a valid cron expression")
|
||||||
|
}
|
||||||
|
if !cfg.trash_purge_schedule.is_empty() && cfg.trash_purge_schedule.parse::<Schedule>().is_err() {
|
||||||
|
err!("`TRASH_PURGE_SCHEDULE` is not a valid cron expression")
|
||||||
|
}
|
||||||
|
if !cfg.incomplete_2fa_schedule.is_empty() && cfg.incomplete_2fa_schedule.parse::<Schedule>().is_err() {
|
||||||
|
err!("`INCOMPLETE_2FA_SCHEDULE` is not a valid cron expression")
|
||||||
|
}
|
||||||
|
if !cfg.emergency_notification_reminder_schedule.is_empty()
|
||||||
|
&& cfg.emergency_notification_reminder_schedule.parse::<Schedule>().is_err()
|
||||||
|
{
|
||||||
|
err!("`EMERGENCY_NOTIFICATION_REMINDER_SCHEDULE` is not a valid cron expression")
|
||||||
|
}
|
||||||
|
if !cfg.emergency_request_timeout_schedule.is_empty()
|
||||||
|
&& cfg.emergency_request_timeout_schedule.parse::<Schedule>().is_err()
|
||||||
|
{
|
||||||
|
err!("`EMERGENCY_REQUEST_TIMEOUT_SCHEDULE` is not a valid cron expression")
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Laden …
In neuem Issue referenzieren