diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-02-28 17:02:02 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-02-28 17:02:02 +0200 |
commit | b355b984bc914c0a529f2a2d5f1942ebe13d5999 (patch) | |
tree | af23feb66cfa49b1d345b3bd0b5a833e846a02fa /src/plugins | |
parent | d3b505a18272ab490df753ec160b9f8cb6140166 (diff) | |
download | rspamd-b355b984bc914c0a529f2a2d5f1942ebe13d5999.tar.gz rspamd-b355b984bc914c0a529f2a2d5f1942ebe13d5999.zip |
[Minor] Add default configs for several modules
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/metadata_exporter.lua | 3 | ||||
-rw-r--r-- | src/plugins/lua/metric_exporter.lua | 11 | ||||
-rw-r--r-- | src/plugins/lua/rmilter_headers.lua | 3 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 6e3f66fa5..90b28193f 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -524,6 +524,9 @@ if type(settings.rules) ~= 'table' then rspamd_logger.errx(rspamd_config, 'No push backend enabled') return end +elseif not next(settings.rules) then + rspamd_logger.debugm(N, rspamd_config, 'No rules enabled') + return end if not settings.rules or not next(settings.rules) then rspamd_logger.errx(rspamd_config, 'No rules enabled') diff --git a/src/plugins/lua/metric_exporter.lua b/src/plugins/lua/metric_exporter.lua index a7b116c7a..2a2ebb597 100644 --- a/src/plugins/lua/metric_exporter.lua +++ b/src/plugins/lua/metric_exporter.lua @@ -144,14 +144,19 @@ local backends = { local function configure_metric_exporter() local opts = rspamd_config:get_all_opt(N) - if not backends[opts['backend']] then - logger.errx(rspamd_config, 'Backend is invalid or unspecified') + local be = opts['backend'] + if not be then + logger.debugm(N, rspamd_config, 'Backend is unspecified') + return + end + if not backends[be] then + logger.errx(rspamd_config, 'Backend is invalid: ' .. be) return false end for k, v in pairs(opts) do settings[k] = v end - return backends[opts['backend']]['configure']() + return backends[be]['configure']() end if not configure_metric_exporter() then return end diff --git a/src/plugins/lua/rmilter_headers.lua b/src/plugins/lua/rmilter_headers.lua index 77eed1785..82a4de6bf 100644 --- a/src/plugins/lua/rmilter_headers.lua +++ b/src/plugins/lua/rmilter_headers.lua @@ -322,6 +322,9 @@ local opts = rspamd_config:get_all_opt(N) if not opts then return end if type(opts['use']) == 'string' then opts['use'] = {opts['use']} +elseif (type(opts['use']) == 'table' and not opts['use'][1]) then + logger.debugm(N, rspamd_config, 'no functions are enabled') + return end if type(opts['use']) ~= 'table' then logger.errx(rspamd_config, 'unexpected type for "use" option: %s', type(opts['use'])) |