From: Rigel Kent Date: Mon, 21 May 2018 11:26:04 +0000 (+0200) Subject: feature: db selection in redis X-Git-Tag: v1.0.0-beta.5~11 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=30c82f0d2e9adacc1d3398822aa7810c0ccbceb4;p=oweals%2Fpeertube.git feature: db selection in redis resolves #579 --- diff --git a/config/default.yaml b/config/default.yaml index 995638281..8a177e628 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -25,6 +25,7 @@ redis: hostname: 'localhost' port: 6379 auth: null + db: 0 smtp: hostname: null diff --git a/config/production.yaml.example b/config/production.yaml.example index 71344fa35..51d5c5180 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -27,6 +27,7 @@ redis: hostname: 'localhost' port: 6379 auth: null + db: 0 # SMTP server to send emails smtp: diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts index c11dc7a89..5a9c603b5 100644 --- a/server/initializers/checker.ts +++ b/server/initializers/checker.ts @@ -22,7 +22,7 @@ function checkMissedConfig () { 'webserver.https', 'webserver.hostname', 'webserver.port', 'trust_proxy', 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', - 'redis.hostname', 'redis.port', 'redis.auth', + 'redis.hostname', 'redis.port', 'redis.auth', 'redis.db', 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address', 'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache', 'log.level', diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 51d272895..424947590 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -111,7 +111,8 @@ const CONFIG = { REDIS: { HOSTNAME: config.get('redis.hostname'), PORT: config.get('redis.port'), - AUTH: config.get('redis.auth') + AUTH: config.get('redis.auth'), + DB: config.get('redis.db') }, SMTP: { HOSTNAME: config.get('smtp.hostname'), diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index acc69ef24..0333464bd 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts @@ -56,7 +56,8 @@ class JobQueue { redis: { host: CONFIG.REDIS.HOSTNAME, port: CONFIG.REDIS.PORT, - auth: CONFIG.REDIS.AUTH + auth: CONFIG.REDIS.AUTH, + db: CONFIG.REDIS.DB } }) diff --git a/server/lib/redis.ts b/server/lib/redis.ts index 0acb9ff0e..97ff3598b 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts @@ -26,7 +26,8 @@ class Redis { this.client = createClient({ host: CONFIG.REDIS.HOSTNAME, - port: CONFIG.REDIS.PORT + port: CONFIG.REDIS.PORT, + db: CONFIG.REDIS.DB }) this.client.on('error', err => {