diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-09-01 16:41:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-01 16:41:41 +0100 |
commit | 2d90a61b3a70bc75735575435276c9226c7f2c0f (patch) | |
tree | 3e4073dbcd20744cb02caa51d8b12d6e451bcae0 /src/plugins/lua/settings.lua | |
parent | 99c2eb287a15649c0dac67065b0254c2a94a768f (diff) | |
parent | f552edd887794a5086dcf93d36f8f82d83553196 (diff) | |
download | rspamd-2d90a61b3a70bc75735575435276c9226c7f2c0f.tar.gz rspamd-2d90a61b3a70bc75735575435276c9226c7f2c0f.zip |
Merge pull request #924 from fatalbanana/enabled
[Feature] Add common way to disable Lua modules
Diffstat (limited to 'src/plugins/lua/settings.lua')
-rw-r--r-- | src/plugins/lua/settings.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 1b632f747..e857d7f8e 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -18,7 +18,14 @@ limitations under the License. -- Settings documentation can be found here: -- https://rspamd.com/doc/configuration/settings.html +local rspamd_logger = require "rspamd_logger" local set_section = rspamd_config:get_all_opt("settings") +if not (set_section and type(set_section) == 'table') then + rspamd_logger.infox('Module is unconfigured') +elseif set_section['enabled'] == false then + rspamd_logger.infox('Module is disabled') + return +end local settings = { [1] = {}, @@ -28,7 +35,6 @@ local settings = { local settings_ids = {} local settings_initialized = false local max_pri = 0 -local rspamd_logger = require "rspamd_logger" local rspamd_ip = require "rspamd_ip" local rspamd_regexp = require "rspamd_regexp" local ucl = require "ucl" |