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,