diff --git a/crates/common/src/manager/config.rs b/crates/common/src/manager/config.rs index fba77913..3bdcc82c 100644 --- a/crates/common/src/manager/config.rs +++ b/crates/common/src/manager/config.rs @@ -329,7 +329,11 @@ impl ConfigManager { }) } - pub async fn update_config_resource(&self, resource_id: &str) -> trc::Result> { + pub async fn update_config_resource( + &self, + resource_id: &str, + overwrite: bool, + ) -> trc::Result> { let external = self .fetch_config_resource(resource_id) .await @@ -345,7 +349,7 @@ impl ConfigManager { .await? .map_or(true, |v| v != external.version) { - self.set(external.keys, false).await?; + self.set(external.keys, overwrite).await?; trc::event!( Config(trc::ConfigEvent::ImportExternal), @@ -387,6 +391,7 @@ impl ConfigManager { external.keys.push(ConfigKey::from((key, value))); } else if key.starts_with("spam-filter.") || key.starts_with("http-lookup.") + || (key.starts_with("lookup.") && !key.starts_with("lookup.default.")) || key.starts_with("server.asn.") || key.starts_with("queue.quota.") || key.starts_with("queue.throttle.") diff --git a/crates/jmap/src/api/management/reload.rs b/crates/jmap/src/api/management/reload.rs index 727f3165..8fa811f5 100644 --- a/crates/jmap/src/api/management/reload.rs +++ b/crates/jmap/src/api/management/reload.rs @@ -98,7 +98,10 @@ impl ManageReload for Server { .map_err(|err| { trc::EventType::Server(trc::ServerEvent::ThreadError) .reason(err) - .details("Failed to send settings reload event to housekeeper") + .details(concat!( + "Failed to send settings reload ", + "event to housekeeper" + )) .caused_by(trc::location!()) })?; } @@ -123,12 +126,14 @@ impl ManageReload for Server { // Validate the access token access_token.assert_has_permission(Permission::SpamFilterUpdate)?; + let overwrite = UrlParams::new(req.uri().query()).has_key("overwrite"); + Ok(JsonResponse::new(json!({ "data": self .core .storage .config - .update_config_resource("spam-filter") + .update_config_resource("spam-filter", overwrite) .await?, })) .into_http_response())