Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support REDIS_PASSWORD env variable #280

Merged
merged 1 commit into from
Dec 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/Cube.js-Backend/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Production Cube.js servers can be accessed only with [REST API](rest-api) and Cu
### Redis

Also, Cube.js requires [Redis](https://redis.io/), in-memory data structure store, to run in production.
It uses it for query caching and queue.
Set `REDIS_URL` environment variable to provide Cube.js with Redis connection.
It uses Redis for query caching and queue.
Set `REDIS_URL` environment variable to provide Cube.js with Redis connection. In case your Redis instance has password, please set password via `REDIS_PASSWORD` environment variable.
Make sure, your Redis allows at least 15 concurrent connections.
Set `REDIS_TLS` env variable to `true` if you want to enable secure connection.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ const { promisify } = require('util');
module.exports = function createRedisClient(url) {
redis.Multi.prototype.execAsync = promisify(redis.Multi.prototype.exec);

let options;
let options = {
url,
};

if (process.env.REDIS_TLS === 'true') {
options = {
url,
tls: {}
};
options.tls = {};
}

const client = redis.createClient(options || url);
if (process.env.REDIS_PASSWORD) {
options.password = process.env.REDIS_PASSWORD;
}

const client = redis.createClient(options);

['brpop', 'del', 'get', 'hget', 'rpop', 'set', 'zadd', 'zrange', 'zrangebyscore', 'keys'].forEach(
k => {
Expand Down