diff options
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_common.c | 2 | ||||
-rw-r--r-- | src/lua/lua_config.c | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 942f5a9b6..f77fe6b6e 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -423,6 +423,7 @@ rspamd_lua_init () * disabled_redis = {}, * disabled_explicitly = {}, * disabled_failed = {}, + * disabled_experimental = {}, * } */ #define ADD_TABLE(name) do { \ @@ -436,6 +437,7 @@ rspamd_lua_init () ADD_TABLE (disabled_redis); ADD_TABLE (disabled_explicitly); ADD_TABLE (disabled_failed); + ADD_TABLE (disabled_experimental); #undef ADD_TABLE lua_setglobal (L, rspamd_modules_state_global); diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 935ee7806..5a6bac8bc 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -667,6 +667,13 @@ LUA_FUNCTION_DEF (config, get_cpu_flags); */ LUA_FUNCTION_DEF (config, has_torch); +/*** + * @method rspamd_config:experimental_enabled() + * Returns true if experimental plugins are enabled + * @return {boolean} true if experimental plugins are enabled + */ +LUA_FUNCTION_DEF (config, experimental_enabled); + static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, get_module_opt), LUA_INTERFACE_DEF (config, get_mempool), @@ -722,6 +729,7 @@ static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, set_peak_cb), LUA_INTERFACE_DEF (config, get_cpu_flags), LUA_INTERFACE_DEF (config, has_torch), + LUA_INTERFACE_DEF (config, experimental_enabled), {"__tostring", rspamd_lua_class_tostring}, {"__newindex", lua_config_newindex}, {NULL, NULL} @@ -2950,6 +2958,22 @@ lua_config_has_torch (lua_State *L) } static gint +lua_config_experimental_enabled (lua_State *L) +{ + struct rspamd_config *cfg = lua_check_config (L, 1); + + if (cfg != NULL) { + lua_pushboolean (L, cfg->enable_experimental); + } + else { + return luaL_error (L, "invalid arguments"); + } + + return 1; +} + + +static gint lua_monitored_alive (lua_State *L) { struct rspamd_monitored *m = lua_check_monitored (L, 1); |