Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; // global const for redis
var connection = require("url").parse(REDIS_URL); // parse redis url
REDIS_PARAMS = {}; // global const for redis connection settings, also used by
REDIS_PARAMS.port = connection.port; = connection.hostname;
// connect to redis so we can put the express session there
var client = redis.createClient(REDIS_PARAMS.port,;
if ( connection.auth ) {
// REDIS_PARAMS.pass = connection.auth.split(":")[1];
REDIS_PARAMS.pass = connection.auth;
client.auth(REDIS_PARAMS.pass, function (err) {
if (err) throw err;
else console.log('authorised to redis at: '+
} else console.log('connected to redis at: '+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment