diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-27 23:09:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-27 23:09:26 +0000 |
commit | bcb71e68b1491717d41d850e98be36ea346697d0 (patch) | |
tree | 761e220ac37adfe42b8b88a6d5f7f23cbb4da183 | |
parent | ab4ec231e0a0bfbc9bd993be30b7c4ca220fcc2c (diff) | |
download | rspamd-bcb71e68b1491717d41d850e98be36ea346697d0.tar.gz rspamd-bcb71e68b1491717d41d850e98be36ea346697d0.zip |
[Minor] Allow to use external map in explicitly set settings
-rw-r--r-- | src/plugins/lua/settings.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index e86b7f6b2..136de077a 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -169,6 +169,7 @@ local function check_query_settings(task) if settings_id and settings_initialized then local cached = lua_settings.settings_by_id(settings_id) + lua_util.debugm(N, task, "check settings id for %s", settings_id) if cached then local elt = cached.settings @@ -180,8 +181,8 @@ local function check_query_settings(task) if nset then elt.apply = lua_util.override_defaults(nset, elt.apply) end - return elt.apply, cached, cached.priority or 1 end + return elt.apply, cached, cached.priority or 1 else rspamd_logger.warnx(task, 'no settings id "%s" has been found', settings_id) if nset then @@ -333,6 +334,7 @@ local function check_settings(task) end local min_pri = 1 + lua_util.debugm(N, task, "hui: %s", id_elt) if query_apply then if priority >= min_pri then -- Do not check lower or equal priorities @@ -345,6 +347,17 @@ local function check_settings(task) return end + elseif id_elt and type(id_elt.settings) == 'table' and id_elt.settings.external_map then + local external_map = id_elt.settings.external_map + local selector_result = external_map.selector(task) + + if selector_result then + external_map.map:get_key(selector_result, nil, task) + -- No more selection logic + return + else + rspamd_logger.infox("cannot query selector to make external map request") + end end -- Do not waste resources |