local lua_settings = require "lua_settings"
local ucl = require "ucl"
local fun = require "fun"
-local rspamd_mempool = require "rspamd_mempool"
local redis_params
end
-- Process settings based on their priority
-local function process_settings_table(tbl, allow_ids, mempool, is_static)
+local function process_settings_table(tbl, allow_ids, is_static)
local get_priority = function(elt)
local pri_tonum = function(p)
if p then
local rspamd_expression = require "rspamd_expression"
out.expression = rspamd_expression.create(elt.expression, parse_atom,
- mempool)
+ rspamd_config:get_mempool())
out.checks = checks
if not out.expression then
end
-- Parse settings map from the ucl line
-local settings_map_pool
local function process_settings_map(map_text)
local parser = ucl.parser()
local res,err
if not res then
rspamd_logger.warnx(rspamd_config, 'cannot parse settings map: ' .. err)
else
- if settings_map_pool then
- settings_map_pool:destroy()
- end
-
- settings_map_pool = rspamd_mempool.create()
-
local obj = parser:get_object()
if obj['settings'] then
- process_settings_table(obj['settings'], false, settings_map_pool)
+ process_settings_table(obj['settings'], false, false)
else
- process_settings_table(obj, false, settings_map_pool)
+ process_settings_table(obj, false, false)
end
end
rspamd_logger.errx(rspamd_config, 'cannot load settings from %1', set_section)
end
elseif set_section and type(set_section) == "table" then
- settings_map_pool = rspamd_mempool.create()
-- We need to check this table and register static symbols first
-- Postponed settings init is needed to ensure that all symbols have been
-- registered BEFORE settings plugin. Otherwise, we can have inconsistent settings expressions
end, set_section)
)
rspamd_config:add_post_init(function ()
- process_settings_table(set_section, true, settings_map_pool, true)
+ process_settings_table(set_section, true, true)
end, 100)
end
-
-rspamd_config:add_config_unload(function()
- if settings_map_pool then
- settings_map_pool:destroy()
- end
-end)