Created
January 21, 2013 15:52
-
-
Save Southern/4586993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 socket.io | |
REDIS_PARAMS.port = connection.port; | |
REDIS_PARAMS.host = connection.hostname; | |
// connect to redis so we can put the express session there | |
var client = redis.createClient(REDIS_PARAMS.port, REDIS_PARAMS.host); | |
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: '+ REDIS_PARAMS.host) | |
}); | |
} else console.log('connected to redis at: '+ REDIS_PARAMS.host) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment