Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: check at configuration load time that default adapter is set if needec
Lars Wirzenius committed 5 months ago
commit 24c95c85db3147a8167bb16a7d1a1711942fe499
parent 8413204
1 file changed +7 -1
modified src/config.rs
@@ -83,6 +83,10 @@ impl Config {
            logger::config_deprecated("status_update_interval_seconds", filename);
        }

+
        if !self.filters().is_empty() && self.default_adapter.is_none() {
+
            return Err(ConfigError::NoDefaultAdapter);
+
        }
+

        if let Some(triggers) = &self.triggers {
            for trigger in triggers.iter() {
                if !self.adapters.contains_key(&trigger.adapter) {
@@ -221,7 +225,9 @@ pub enum ConfigError {
    ToJson(#[source] serde_json::Error),

    /// No default adapter.
-
    #[error("the default adapter is not defined in the configuration")]
+
    #[error(
+
        "the default adapter is not defined in the configuration, but is required for the filters field"
+
    )]
    NoDefaultAdapter,

    /// Unknown adapter.