diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-22 09:59:43 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-22 09:59:43 +0000 |
commit | b0cf71db435fa0e010b1cc372f6b7ef834d7bb22 (patch) | |
tree | 466f027efc4efeb20d58df1ef8c0a7785828fb04 /src/plugins/lua/settings.lua | |
parent | 18a9a0b584a6e469bedbf431d0f310e3bd9736c2 (diff) | |
download | rspamd-b0cf71db435fa0e010b1cc372f6b7ef834d7bb22.tar.gz rspamd-b0cf71db435fa0e010b1cc372f6b7ef834d7bb22.zip |
[Minor] Allow lua maps to process opaque texts
Diffstat (limited to 'src/plugins/lua/settings.lua')
-rw-r--r-- | src/plugins/lua/settings.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index bc91bf4c8..7427e779d 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -1036,9 +1036,9 @@ end -- Parse settings map from the ucl line local settings_map_pool -local function process_settings_map(string) +local function process_settings_map(map_text) local parser = ucl.parser() - local res,err = parser:parse_string(string) + local res,err = parser:parse_string(map_text) if not res then rspamd_logger.warnx(rspamd_config, 'cannot parse settings map: ' .. err) else @@ -1162,7 +1162,13 @@ local set_section = rspamd_config:get_all_opt("settings") if set_section and set_section[1] and type(set_section[1]) == "string" then -- Just a map of ucl - if not rspamd_config:add_map(set_section[1], "settings map", process_settings_map) then + local map_attrs = { + url = set_section[1], + description = "settings map", + callback = process_settings_map, + opaque_data = true + } + if not rspamd_config:add_map(map_attrs) then rspamd_logger.errx(rspamd_config, 'cannot load settings from %1', set_section) end elseif set_section and type(set_section) == "table" then |