From: Vsevolod Stakhov Date: Tue, 2 Jul 2019 15:49:15 +0000 (+0100) Subject: [Minor] Register settings symbols X-Git-Tag: 2.0~676 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=af66b629a1ddbc14b678ebbd2ba5925998d1b67d;p=rspamd.git [Minor] Register settings symbols --- diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 084f51467..bfd11c439 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -836,9 +836,9 @@ local function process_settings_table(tbl, allow_ids, mempool) -- By De Morgan laws if inverse then s = ' || ' end -- Exclude aliases and join all checks by key - local expr_str = table.concat(fun.totable(fun.map(function(k, _) - return k end, - fun.filter(function(k, _) return not aliases[k] end, checks))), s) + local expr_str = table.concat(lua_util.keys(fun.filter( + function(k, _) return not aliases[k] end, + checks)), s) if inverse then expr_str = string.format('!(%s)', expr_str) @@ -911,12 +911,24 @@ local function process_settings_table(tbl, allow_ids, mempool) if elt['id'] then out.id = lua_settings.register_settings_id(elt.id, out) - lua_util.debugm(N, rspamd_config, 'added settings id to "%s": %s -> %s', + lua_util.debugm(N, rspamd_config, + 'added settings id to "%s": %s -> %s', name, elt.id, out.id) end + + if elt.apply.symbols then + -- Register virtual symbols + for _,sym in ipairs(elt.apply.symbols) do + rspamd_config.register_symbol{ + name = sym, + type = 'virtual,ghost', + } + end + end else if elt['id'] then - rspamd_logger.errx(rspamd_config, 'cannot set static IDs from dynamic settings, please read the docs') + rspamd_logger.errx(rspamd_config, + 'cannot set static IDs from dynamic settings, please read the docs') end end