commit 3c918d2: [Minor] Allow to work without rspamd_config object

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Apr 6 08:42:32 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-06 09:36:00 +0100
URL: https://github.com/rspamd/rspamd/commit/3c918d26c6692e3f8abd524adf751fdf0d36ff62 (HEAD -> master)

[Minor] Allow to work without rspamd_config object

---
 lualib/lua_redis.lua | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua
index a93545f23..941ac383a 100644
--- a/lualib/lua_redis.lua
+++ b/lualib/lua_redis.lua
@@ -310,16 +310,18 @@ local function process_redis_opts(options, redis_params)
 end
 
 local function enrich_defaults(rspamd_config, module, redis_params)
-  local opts = rspamd_config:get_all_opt('redis')
+  if rspamd_config then
+    local opts = rspamd_config:get_all_opt('redis')
 
-  if opts then
-    if module then
-      if opts[module] then
-        process_redis_opts(opts[module], redis_params)
+    if opts then
+      if module then
+        if opts[module] then
+          process_redis_opts(opts[module], redis_params)
+        end
       end
-    end
 
-    process_redis_opts(opts, redis_params)
+      process_redis_opts(opts, redis_params)
+    end
   end
 end
 


More information about the Commits mailing list