fix redis ignoring configs (fixes #41). now redis_url is used instead of redis_host and redis_port

This commit is contained in:
orenom
2022-01-13 19:39:34 +01:00
parent 0c53c2444c
commit 521eedeaf1
2 changed files with 5 additions and 18 deletions
+3 -4
View File
@@ -15,14 +15,13 @@ const config = {
ssl_port: process.env.SSL_PORT || 8088,
cert_dir: process.env.CERT_DIR || ``, // For example '/home/wikiless/letsencrypt/live/wikiless.org'. No trailing slash.
redirect_http_to_https: process.env.REDIRECT_HTTP_TO_HTTPS === 'true' || false, // If true, HTTP requests will be redirected to HTTPS.
/**
* You can configure redis below if needed.
*/
redis_host: process.env.REDIS_HOST || '127.0.0.1',
redis_url: process.env.REDIS_HOST || 'redis://127.0.0.1:6379',
redis_password: process.env.REDIS_PASSWORD,
redis_port: process.env.REDIS_PORT || 6379,
/**
* You might need to change these configs below if you host through a reverse
* proxy like nginx.
+2 -14
View File
@@ -10,20 +10,8 @@ const bodyParser = require('body-parser')
const redis = (() => {
const redisOptions = {
host: '127.0.0.1',
port: 6379
}
if(config.redis_host) {
redisOptions.host = config.redis_host
}
if(config.redis_port && config.redis_port > 0) {
redisOptions.port = config.redis_port
}
if(config.redis_password) {
redisOptions.password = config.redis_password
url: config.redis_url,
password: config.redis_password
}
const client = r.createClient(redisOptions)