From 8b366d9ffd483720bcf2eac2acb18c1742ceb077 Mon Sep 17 00:00:00 2001 From: 3np <3np@3np> Date: Mon, 5 Apr 2021 19:11:11 +0900 Subject: [PATCH] Add config REDIS_DB, REDIS_PASSWORD --- app.js | 8 ++++++++ config.js.template | 2 ++ 2 files changed, 10 insertions(+) diff --git a/app.js b/app.js index 83214dc..ff38ac1 100644 --- a/app.js +++ b/app.js @@ -28,6 +28,10 @@ const redis = (() => { port: 6379 } + if (config.redis_db) { + redisOptions.db = config.redis_db + } + if (config.redis_host) { redisOptions.host = config.redis_host } @@ -36,6 +40,10 @@ const redis = (() => { redisOptions.port = config.redis_port } + if (config.redis_password) { + redisOptions.password = config.redis_password + } + return r.createClient(redisOptions) })() const helmet = require('helmet') diff --git a/config.js.template b/config.js.template index aacb13c..13bd153 100644 --- a/config.js.template +++ b/config.js.template @@ -8,7 +8,9 @@ const config = { api_enabled: process.env.API_ENABLED !== 'true' || true, // Teddit API feature. Might increase loads significantly on your instance. video_enabled: process.env.VIDEO_ENABLED !== 'true' || true, redis_enabled: process.env.REDIS_ENABLED !== 'true' || true, // If disabled, does not cache Reddit API calls + redis_db: process.env.REDIS_DB, redis_host: process.env.REDIS_HOST || '127.0.0.1', + redis_password: process.env.REDIS_PASSWORD, redis_port: process.env.REDIS_PORT || 6379, ssl_port: process.env.SSL_PORT || 8088, nonssl_port: process.env.NONSSL_PORT || 8080,