mirror of
https://github.com/rspamd/rspamd.git
synced 2024-09-02 05:58:19 +02:00
[Minor] Use upstreams for external maps
This commit is contained in:
parent
569290a090
commit
fbac436579
@ -307,14 +307,20 @@ local function rspamd_map_add_from_ucl(opt, mtype, description, callback)
|
|||||||
else
|
else
|
||||||
if opt.external then
|
if opt.external then
|
||||||
-- External map definition, missing fields are handled by schema
|
-- External map definition, missing fields are handled by schema
|
||||||
local parse_err
|
local parse_res,parse_err = external_map_schema(opt)
|
||||||
ret.__data,parse_err = external_map_schema(opt)
|
|
||||||
|
|
||||||
if ret then
|
if parse_res then
|
||||||
ret.__external = true
|
ret.__upstreams = lua_util.http_upstreams_by_url(rspamd_config:get_mempool(), opt.backend)
|
||||||
setmetatable(ret, ret_mt)
|
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
|
else
|
||||||
rspamd_logger.errx(rspamd_config, 'cannot parse external map: %s',
|
rspamd_logger.errx(rspamd_config, 'cannot parse external map: %s',
|
||||||
parse_err)
|
parse_err)
|
||||||
|
Loading…
Reference in New Issue
Block a user