commit a60d02d: [Minor] Allow to register preloads for external services

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Nov 12 21:21:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-12 12:27:01 +0000
URL: https://github.com/rspamd/rspamd/commit/a60d02d527b5af86dfc484b114fe607cc6674856

[Minor] Allow to register preloads for external services

---
 src/plugins/lua/external_services.lua | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/plugins/lua/external_services.lua b/src/plugins/lua/external_services.lua
index 0157d15a9..02068685b 100644
--- a/src/plugins/lua/external_services.lua
+++ b/src/plugins/lua/external_services.lua
@@ -378,6 +378,15 @@ if opts and type(opts) == 'table' then
             group = group
           })
         end
+
+        -- Add preloads if a module requires that
+        if type(m.preloads) == 'table' then
+          for _,preload in ipairs(m.preloads) do
+            rspamd_config:add_on_load(function(cfg, ev_base, worker)
+              preload(m, cfg, ev_base, worker)
+            end)
+          end
+        end
       end
     end
   end


More information about the Commits mailing list