]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] whitelist: use contemporary API for maps 5746/head
authorAndrew Lewis <nerf@judo.za.org>
Fri, 14 Nov 2025 10:24:49 +0000 (12:24 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Fri, 14 Nov 2025 10:24:49 +0000 (12:24 +0200)
src/plugins/lua/whitelist.lua

index fa76da8d13d9fc323058c477166769dc1bec0355..dba2e4056a0d859733d50a1911ead01bdccad156 100644 (file)
@@ -22,6 +22,7 @@ local rspamd_logger = require "rspamd_logger"
 local rspamd_util = require "rspamd_util"
 local fun = require "fun"
 local lua_util = require "lua_util"
+local lua_maps = require "lua_maps"
 
 local N = "whitelist"
 
@@ -338,11 +339,8 @@ local configure_whitelist_module = function()
     fun.each(function(symbol, rule)
       if rule['domains'] then
         if type(rule['domains']) == 'string' then
-          rule['map'] = rspamd_config:add_map {
-            url = rule['domains'],
-            description = "Whitelist map for " .. symbol,
-            type = 'map'
-          }
+          rule['map'] = lua_maps.rspamd_map_add_from_ucl(rule['domains'], 'map',
+              "Whitelist map for " .. symbol)
         elseif type(rule['domains']) == 'table' then
           -- Transform ['domain1', 'domain2' ...] to indexes:
           -- {'domain1' = 1, 'domain2' = 1 ...]
@@ -366,11 +364,8 @@ local configure_whitelist_module = function()
               return d, 1.0
             end, rule['domains']))
           else
-            rule['map'] = rspamd_config:add_map {
-              url = rule['domains'],
-              description = "Whitelist map for " .. symbol,
-              type = 'map'
-            }
+            rule['map'] = lua_maps.rspamd_map_add_from_ucl(rule['domains'], 'map',
+                "Whitelist map for " .. symbol)
           end
         else
           rspamd_logger.errx(rspamd_config, 'whitelist %s has bad "domains" value',