]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/redis.ts
Add plugin table migration table
[github/Chocobozzz/PeerTube.git] / server / lib / redis.ts
index a7ec8c9df92f089e84b82365c9bfc0a7349c3428..f77d0b62c20ba22d3a92c01da5e097b7b35cf8c1 100644 (file)
@@ -8,7 +8,7 @@ import {
   USER_PASSWORD_RESET_LIFETIME,
   VIDEO_VIEW_LIFETIME,
   WEBSERVER
-} from '../initializers'
+} from '../initializers/constants'
 import { CONFIG } from '../initializers/config'
 
 type CachedRoute = {
@@ -31,7 +31,7 @@ class Redis {
     if (this.initialized === true) return
     this.initialized = true
 
-    this.client = createClient(Redis.getRedisClient())
+    this.client = createClient(Redis.getRedisClientOptions())
 
     this.client.on('error', err => {
       logger.error('Error in Redis client.', { err })
@@ -45,7 +45,7 @@ class Redis {
     this.prefix = 'redis-' + WEBSERVER.HOST + '-'
   }
 
-  static getRedisClient () {
+  static getRedisClientOptions () {
     return Object.assign({},
       (CONFIG.REDIS.AUTH && CONFIG.REDIS.AUTH != null) ? { password: CONFIG.REDIS.AUTH } : {},
       (CONFIG.REDIS.DB) ? { db: CONFIG.REDIS.DB } : {},
@@ -55,6 +55,14 @@ class Redis {
     )
   }
 
+  getClient () {
+    return this.client
+  }
+
+  getPrefix () {
+    return this.prefix
+  }
+
   /************* Forgot password *************/
 
   async setResetPasswordVerificationString (userId: number) {