]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to register preloads for external services
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 12 Nov 2021 12:27:01 +0000 (12:27 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 12 Nov 2021 12:27:01 +0000 (12:27 +0000)
src/plugins/lua/external_services.lua

index 0157d15a997e00ecade276fd026af2d679123911..02068685bbc9e1e76f7b6ae85a86aa16a5fa498a 100644 (file)
@@ -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