Merge pull request 'Add config REDIS_DB, REDIS_PASSWORD' (#183) from 3np/teddit:redis-conf into main

Reviewed-on: https://codeberg.org/teddit/teddit/pulls/183
This commit is contained in:
teddit 2021-04-05 12:13:44 +02:00
commit 649132ef94
2 changed files with 10 additions and 0 deletions

8
app.js
View File

@ -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')

View File

@ -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,