]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Conf] Add configuration support for hs_helper worker
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 8 Jan 2026 15:04:17 +0000 (15:04 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 8 Jan 2026 15:04:17 +0000 (15:04 +0000)
Add worker-hs_helper.conf and worker-hs_helper.inc config files that are
only installed when hyperscan support is enabled. The main rspamd.conf
uses try=true to gracefully handle missing config on non-hyperscan builds.

cmake/InstallRspamdFiles.cmake
conf/rspamd.conf
conf/worker-hs_helper.conf [new file with mode: 0644]
conf/worker-hs_helper.inc [new file with mode: 0644]

index 75a6fe447affaeb76c5dd7879c89ade1aaada808..634b0d5b8d72facdc1975a41abbc9fcf19aae7d6 100644 (file)
@@ -18,6 +18,12 @@ function(InstallRspamdFiles)
 
     file(GLOB_RECURSE CONF_FILES RELATIVE "${CMAKE_SOURCE_DIR}/conf" CONFIGURE_DEPENDS
             ${GLOB_PATTERNS})
+
+    # Exclude hyperscan-specific config when hyperscan is disabled
+    if (NOT ENABLE_HYPERSCAN)
+        list(REMOVE_ITEM CONF_FILES "worker-hs_helper.conf" "worker-hs_helper.inc")
+    endif ()
+
     foreach (CONF_FILE ${CONF_FILES})
         get_filename_component(_rp ${CONF_FILE} PATH)
         install(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${CONFDIR}/${_rp})")
index f2ed0a0f5130bd3a639e8c1ed430329af4016f2b..ead71ae82256ab31a4ac0ae81f3a57616787aabc 100644 (file)
@@ -68,3 +68,6 @@ worker "fuzzy" {
     .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-fuzzy.inc"
     .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-fuzzy.inc"
 }
+
+# Hyperscan helper worker (only available when built with hyperscan support)
+.include(try=true) "$CONFDIR/worker-hs_helper.conf"
diff --git a/conf/worker-hs_helper.conf b/conf/worker-hs_helper.conf
new file mode 100644 (file)
index 0000000..79ad265
--- /dev/null
@@ -0,0 +1,8 @@
+# Hyperscan helper worker
+# This file is only installed when hyperscan support is enabled
+
+worker "hs_helper" {
+    .include "$CONFDIR/worker-hs_helper.inc"
+    .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-hs_helper.inc"
+    .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-hs_helper.inc"
+}
diff --git a/conf/worker-hs_helper.inc b/conf/worker-hs_helper.inc
new file mode 100644 (file)
index 0000000..779bf28
--- /dev/null
@@ -0,0 +1,27 @@
+# Hyperscan helper worker setup
+# Please don't modify this file as your changes might be overwritten with
+# the next update.
+#
+# You can modify 'local.d/worker-hs_helper.inc' to add and merge
+# parameters defined inside this section
+#
+# You can modify 'override.d/worker-hs_helper.inc' to strictly override all
+# parameters defined inside this section
+#
+# See https://rspamd.com/doc/faq.html#what-are-the-locald-and-overrided-directories
+# for details
+#
+# This worker compiles hyperscan databases in the background, allowing
+# the main rspamd process to start quickly without blocking on compilation.
+
+# Directory to store compiled hyperscan databases
+# cache_dir = "${DBDIR}";
+
+# Cache backend: file (default), redis, http, or lua
+# cache_backend = "file";
+
+# Maximum time allowed for compiling a single expression (seconds)
+# timeout = 1.0;
+
+# Time between periodic recompilation checks (seconds)
+# recompile = 60.0;