commit fd05dc5: [Minor] Rspamadm: Do a more deep initialisation for clickhouse subcommand

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Apr 6 13:35:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-04-06 14:10:13 +0100
URL: https://github.com/rspamd/rspamd/commit/fd05dc559036804f5a1c3503d957ac53ef5fcaa4

[Minor] Rspamadm: Do a more deep initialisation for clickhouse subcommand

---
 lualib/rspamadm/clickhouse.lua | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lualib/rspamadm/clickhouse.lua b/lualib/rspamadm/clickhouse.lua
index 711437c94..899fbd51c 100644
--- a/lualib/rspamadm/clickhouse.lua
+++ b/lualib/rspamadm/clickhouse.lua
@@ -19,6 +19,7 @@ local lua_clickhouse = require "lua_clickhouse"
 local lua_util = require "lua_util"
 local rspamd_http = require "rspamd_http"
 local rspamd_upstream_list = require "rspamd_upstream_list"
+local rspamd_logger = require "rspamd_logger"
 local ucl = require "ucl"
 
 local E = {}
@@ -133,8 +134,18 @@ local function load_config(config_file)
   local _r,err = rspamd_config:load_ucl(config_file)
 
   if not _r then
-    io.stderr:write(string.format('cannot parse %s: %s',
-        config_file, err))
+    rspamd_logger.errx('cannot load %s: %s', config_file, err)
+    os.exit(1)
+  end
+
+  _r,err = rspamd_config:parse_rcl({'logging', 'worker'})
+  if not _r then
+    rspamd_logger.errx('cannot process %s: %s', config_file, err)
+    os.exit(1)
+  end
+
+  if not rspamd_config:init_modules() then
+    rspamd_logger.errx('cannot init modules when parsing %s', config_file)
     os.exit(1)
   end
 end


More information about the Commits mailing list