local bucket_schema = T.table({
burst = T.one_of({
T.number(),
- T.transform(T.string(), lua_util.dehumanize_number)
+ T.transform(T.number(), function(val)
+ if type(val) == "string" then
+ return lua_util.dehumanize_number(val)
+ end
+ return val
+ end)
}):doc({ summary = "Burst size (number of messages)" }),
rate = T.one_of({
T.number(),
- T.transform(T.string(), str_to_rate)
+ T.transform(T.number(), function(val)
+ if type(val) == "string" then
+ return str_to_rate(val)
+ end
+ return val
+ end)
}):doc({ summary = "Rate limit (messages per time unit)" }),
skip_recipients = T.boolean():optional():doc({ summary = "Skip per-recipient limits" }),
symbol = T.string():optional():doc({ summary = "Custom symbol name" }),
rule.config = lua_util.override_defaults(rule.config, tbl)
if rule.config.whitelist then
- if lua_maps_exprs.schema(rule.config.whitelist) then
+ if lua_maps_exprs.schema:check(rule.config.whitelist) then
rule.config.whitelist_map = lua_maps_exprs.create(rspamd_config,
rule.config.whitelist, N)
- elseif lua_maps.map_schema(rule.config.whitelist) then
+ elseif lua_maps.map_schema:check(rule.config.whitelist) then
local map = lua_maps.map_add_from_ucl(rule.config.whitelist,
'radix',
sel_type .. ' reputation whitelist')