Skip to content

Commit

Permalink
[Minor] Allow to register symbols from settings explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Nov 27, 2022
1 parent c5eb26e commit ab4ec23
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/plugins/lua/settings.lua
Expand Up @@ -1323,6 +1323,26 @@ elseif set_section and type(set_section) == "table" then
-- Postponed settings init is needed to ensure that all symbols have been
-- registered BEFORE settings plugin. Otherwise, we can have inconsistent settings expressions
fun.each(function(_, elt)
if elt.register_symbols then
for k,v in pairs(elt.register_symbols) do
local rtb = {
type = 'virtual',
parent = module_sym_id,
}
if type(k) == 'number' and type(v) == 'string' then
rtb.name = v
elseif type(k) == 'string' then
rtb.name = k
if type(v) == 'table' then
for kk,vv in pairs(v) do
-- Enrich table wih extra values
rtb[kk] = vv
end
end
end
rspamd_config:register_symbol(rtb)
end
end
if elt.apply and elt.apply.symbols then
-- Register virtual symbols
for k,v in pairs(elt.apply.symbols) do
Expand Down

0 comments on commit ab4ec23

Please sign in to comment.