Übernehme fehlende Änderungen
This commit is contained in:
parent
dbf323a02a
commit
b8ce686e11
@ -14,7 +14,7 @@ return {
|
|||||||
cli_port = 4567,
|
cli_port = 4567,
|
||||||
-- The block of text returned by /start.
|
-- The block of text returned by /start.
|
||||||
about_text = [[
|
about_text = [[
|
||||||
Dies ist die BETA-Version von Mikubot v2.
|
Dies ist die BETA-Version von Brawlbot v2.
|
||||||
|
|
||||||
Sende /hilfe, um zu starten
|
Sende /hilfe, um zu starten
|
||||||
]],
|
]],
|
||||||
@ -25,6 +25,16 @@ Sende /hilfe, um zu starten
|
|||||||
-- NOTE that it doesn't matter, if the chat is whitelisted! The USER must be whitelisted!
|
-- NOTE that it doesn't matter, if the chat is whitelisted! The USER must be whitelisted!
|
||||||
enable_inline_for_everyone = true,
|
enable_inline_for_everyone = true,
|
||||||
|
|
||||||
|
-- Redis settings. Only edit if you know what you're doing.
|
||||||
|
redis = {
|
||||||
|
host = '127.0.0.1',
|
||||||
|
port = 6379,
|
||||||
|
use_socket = false, -- Set to true, if you need to connect over a socket
|
||||||
|
socket_path = 'unix:///home/path/to/your/redis/sock',
|
||||||
|
password = nil, -- Set, if you need a password to connect to redis
|
||||||
|
database = nil -- Set, if you want to select another database. Default is 0 (use no ""!)
|
||||||
|
},
|
||||||
|
|
||||||
errors = { -- Generic error messages used in various plugins.
|
errors = { -- Generic error messages used in various plugins.
|
||||||
generic = 'An unexpected error occurred.',
|
generic = 'An unexpected error occurred.',
|
||||||
connection = 'Verbindungsfehler.',
|
connection = 'Verbindungsfehler.',
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
local Redis = require 'redis'
|
local Redis = require 'redis'
|
||||||
local FakeRedis = require 'fakeredis'
|
local FakeRedis = require 'fakeredis'
|
||||||
|
local config = require('config')
|
||||||
local params = {
|
|
||||||
host = os.getenv('REDIS_HOST') or '127.0.0.1',
|
|
||||||
port = tonumber(os.getenv('REDIS_PORT') or 6379)
|
|
||||||
}
|
|
||||||
|
|
||||||
local database = os.getenv('REDIS_DB')
|
|
||||||
local password = os.getenv('REDIS_PASSWORD')
|
|
||||||
|
|
||||||
-- Overwrite HGETALL
|
-- Overwrite HGETALL
|
||||||
Redis.commands.hgetall = Redis.command('hgetall', {
|
Redis.commands.hgetall = Redis.command('hgetall', {
|
||||||
@ -22,7 +15,15 @@ local redis = nil
|
|||||||
|
|
||||||
-- Won't launch an error if fails
|
-- Won't launch an error if fails
|
||||||
local ok = pcall(function()
|
local ok = pcall(function()
|
||||||
redis = Redis.connect(params)
|
if config.redis.use_socket and config.redis.socket_path then
|
||||||
|
redis = Redis.connect(config.redis.socket_path)
|
||||||
|
else
|
||||||
|
local params = {
|
||||||
|
host = config.redis.host,
|
||||||
|
port = config.redis.port
|
||||||
|
}
|
||||||
|
redis = Redis.connect(params)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not ok then
|
if not ok then
|
||||||
@ -33,9 +34,6 @@ if not ok then
|
|||||||
fake_func()
|
fake_func()
|
||||||
fake = FakeRedis.new()
|
fake = FakeRedis.new()
|
||||||
|
|
||||||
print('\27[31mRedis addr: '..params.host..'\27[39m')
|
|
||||||
print('\27[31mRedis port: '..params.port..'\27[39m')
|
|
||||||
|
|
||||||
redis = setmetatable({fakeredis=true}, {
|
redis = setmetatable({fakeredis=true}, {
|
||||||
__index = function(a, b)
|
__index = function(a, b)
|
||||||
if b ~= 'data' and fake[b] then
|
if b ~= 'data' and fake[b] then
|
||||||
@ -45,11 +43,11 @@ if not ok then
|
|||||||
end })
|
end })
|
||||||
|
|
||||||
else
|
else
|
||||||
if password then
|
if config.redis.password then
|
||||||
redis:auth(password)
|
redis:auth(config.redis.password)
|
||||||
end
|
end
|
||||||
if database then
|
if config.redis.database then
|
||||||
redis:select(database)
|
redis:select(config.redis.database)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user