diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-09-07 14:42:15 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-09-07 14:42:15 +0100 |
commit | 59f5dd04d6b30ab32e35801dac4ba659dc8149a0 (patch) | |
tree | 7921a9025bf42468eb5bf645a2ad2f8d58a44683 /lualib | |
parent | f0c6643468c2cd4345fa4b96e7c6d829d94b0312 (diff) | |
download | rspamd-59f5dd04d6b30ab32e35801dac4ba659dc8149a0.tar.gz rspamd-59f5dd04d6b30ab32e35801dac4ba659dc8149a0.zip |
[Fix] Another fix for Redis schema
Issue: #5112
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_redis.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua index 2c77c100a..43acfee65 100644 --- a/lualib/lua_redis.lua +++ b/lualib/lua_redis.lua @@ -24,11 +24,12 @@ local exports = {} local E = {} local N = "lua_redis" +local db_schema = (ts.number / tostring + ts.string):is_optional():describe("Database number") local common_schema = { timeout = (ts.number + ts.string / lutil.parse_time_interval):is_optional():describe("Connection timeout"), - db = ts.string:is_optional():describe("Database number"), - database = ts.string:is_optional():describe("Database number"), - dbname = ts.string:is_optional():describe("Database number"), + db = db_schema, + database = db_schema, + dbname = db_schema, prefix = ts.string:is_optional():describe("Key prefix"), username = ts.string:is_optional():describe("Username"), password = ts.string:is_optional():describe("Password"), @@ -64,7 +65,8 @@ local server_schema = lutil.table_merge({ local enrich_schema = function(external) return ts.one_of { - ts.shape(external), -- no specific redis parameters + ts.shape(lutil.table_merge(common_schema, + external)), -- no specific redis servers (e.g when global settings are used) ts.shape(lutil.table_merge(read_schema, external)), -- read_servers specified ts.shape(lutil.table_merge(write_schema, external)), -- write_servers specified ts.shape(lutil.table_merge(rw_schema, external)), -- both read and write servers defined |