diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-06 21:37:50 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-19 12:44:14 +0000 |
commit | fbac436579ecd04fe3f943d6e04de72f0745e0e9 (patch) | |
tree | 372d2e98c6b60abe8e0980cc52c4387e9f963f6b /lualib | |
parent | 569290a090a934b221bd35f77aefd509500ad330 (diff) | |
download | rspamd-fbac436579ecd04fe3f943d6e04de72f0745e0e9.tar.gz rspamd-fbac436579ecd04fe3f943d6e04de72f0745e0e9.zip |
[Minor] Use upstreams for external maps
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_maps.lua | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lualib/lua_maps.lua b/lualib/lua_maps.lua index 5d55484b2..bbc7c1d9e 100644 --- a/lualib/lua_maps.lua +++ b/lualib/lua_maps.lua @@ -307,14 +307,20 @@ local function rspamd_map_add_from_ucl(opt, mtype, description, callback) else if opt.external then -- External map definition, missing fields are handled by schema - local parse_err - ret.__data,parse_err = external_map_schema(opt) + local parse_res,parse_err = external_map_schema(opt) - if ret then - ret.__external = true - setmetatable(ret, ret_mt) + if parse_res then + ret.__upstreams = lua_util.http_upstreams_by_url(rspamd_config:get_mempool(), opt.backend) + if ret.__upstreams then + ret.__data = opt + ret.__external = true + setmetatable(ret, ret_mt) - return ret + return ret + else + rspamd_logger.errx(rspamd_config, 'cannot parse external map upstreams: %s', + opt.backend) + end else rspamd_logger.errx(rspamd_config, 'cannot parse external map: %s', parse_err) |