aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-22 12:42:56 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-22 12:42:56 +0000
commit6e571d7929b3a5c37f0f31e53ab030b7b44c7130 (patch)
tree81dead7ee376162f1d1902792e4e8461b7f1a121
parent7192a658736be07a748c838dc19b3ba94a5b2d9e (diff)
downloadrspamd-6e571d7929b3a5c37f0f31e53ab030b7b44c7130.tar.gz
rspamd-6e571d7929b3a5c37f0f31e53ab030b7b44c7130.zip
[Minor] Clickhouse: Implement schema addtions
-rw-r--r--src/plugins/lua/clickhouse.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index a9caa5292..6fc611cef 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -59,6 +59,7 @@ local settings = {
subject_privacy_alg = 'blake2', -- default hash-algorithm to obfuscate subject
subject_privacy_prefix = 'obf', -- prefix to show it's obfuscated
subject_privacy_length = 16, -- cut the length of the hash
+ schema_additions = {}, -- additional SQL statements to be executed when schema is uploaded
user = nil,
password = nil,
no_ssl_verify = false,
@@ -731,7 +732,7 @@ local function upload_clickhouse_schema(upstream, ev_base, cfg)
}
-- Apply schema sequentially
- for i,v in ipairs(clickhouse_schema) do
+ fun.each(function(v)
local sql = v
local err, _ = lua_clickhouse.generic_sync(upstream, settings, ch_params, sql)
@@ -740,9 +741,9 @@ local function upload_clickhouse_schema(upstream, ev_base, cfg)
sql, upstream:get_addr():to_string(true), err)
return
end
- rspamd_logger.infox(rspamd_config, 'uploaded clickhouse schema element %s to %s',
- i, upstream:get_addr():to_string(true))
- end
+ rspamd_logger.debugm(N, rspamd_config, 'uploaded clickhouse schema element %s to %s',
+ v, upstream:get_addr():to_string(true))
+ end, fun.chain(clickhouse_schema, settings.schema_additions))
end
local function maybe_apply_migrations(upstream, ev_base, cfg, version)