I create a Redis db on nodejitsu and got a full URI such as:
nodejitsu:nodejitsudb11158161232.redis.irstack.com:f327c9sj29sj26e80b8e975fbebb4@nodejitsudb3058169sj32.redis.irstack.com
Connect-redis wants a host, port, etc... Anyone know of an easy way I can just pass it this string? Didn't seem to work when setting the host to that - mongodb seems to work fine with this schema.
Use url.parse
http://nodejs.org/docs/latest/api/url.html to parse that url into its parts such as host, port, etc....
So diving in the source it looks like it's unable to parse a dsn string. url.parse doesn't return the necessary info so it has to be broken down further.
The full dsn has the redis:// protocol as well - it must be there for this to work. Because my local redis dsn string doesn't have a password/user there is a check for that in case it's missing:
var redisUrl = 'redis://nodejitsu:nodejitsudb3051531232.redis.irstack.com:fd470c971946e8der75fbebb4@nodejitsudb305813frt232.redis.irstack.com:6379';
var redis = url.parse(redisUrl);
app.use(express.session({
secret: settings.sessionSecret,
store: new RedisStore({host: redis.hostname, port: redis.port, pass: redis.auth ? redis.auth.substring(redis.auth.indexOf(':') + 1): null})
}));