diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-28 15:27:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-28 15:27:45 +0000 |
commit | a7d4b165ac8cf311907acf95b3d87c1c2cab12d2 (patch) | |
tree | fe11ea0078dcf7d8308f5de33b0a8b4cfed4c142 | |
parent | 6740640ad0d2a812c1bc3e96dc120aed7c12a3bb (diff) | |
download | rspamd-a7d4b165ac8cf311907acf95b3d87c1c2cab12d2.tar.gz rspamd-a7d4b165ac8cf311907acf95b3d87c1c2cab12d2.zip |
[Minor] Fix rspamd_update initialisation
Issue: #2769
Closes: #2769
-rw-r--r-- | src/plugins/lua/rspamd_update.lua | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/plugins/lua/rspamd_update.lua b/src/plugins/lua/rspamd_update.lua index 51cb5db02..d53d02112 100644 --- a/src/plugins/lua/rspamd_update.lua +++ b/src/plugins/lua/rspamd_update.lua @@ -124,21 +124,25 @@ end -- Configuration part local section = rspamd_config:get_all_opt("rspamd_update") -if section then +if section and section.rules then local trusted_key - fun.each(function(k, elt) - if k == 'key' then - trusted_key = elt + if section.key then + trusted_key = section.key + end + + if type(section.rules) ~= 'table' then + section.rules = {section.rules} + end + + fun.each(function(elt) + local map = rspamd_config:add_map(elt, "rspamd updates map", nil, "callback") + if not map then + rspamd_logger.errx(rspamd_config, 'cannot load updates from %1', elt) else - local map = rspamd_config:add_map(elt, "rspamd updates map", nil, "callback") - if not map then - rspamd_logger.errx(rspamd_config, 'cannot load updates from %1', elt) - else - map:set_callback(gen_callback(map)) - maps['elt'] = map - end + map:set_callback(gen_callback(map)) + maps['elt'] = map end - end, section) + end, section.rules) fun.each(function(k, map) -- Check sanity for maps |