Skip to content

Instantly share code, notes, and snippets.

Created January 21, 2013 15:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Southern/4586993 to your computer and use it in GitHub Desktop.
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