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

Redis client is not configured correctly for session store #9

Open
glkn opened this issue Oct 17, 2014 · 1 comment
Open

Redis client is not configured correctly for session store #9

glkn opened this issue Oct 17, 2014 · 1 comment

Comments

@glkn
Copy link

glkn commented Oct 17, 2014

Derby store is correctly configured with redis settings with

var redisClient;
  if (process.env.REDIS_HOST) {
    redisClient = redis.createClient(process.env.REDIS_PORT, process.env.REDIS_HOST);
    redisClient.auth(process.env.REDIS_PASSWORD);
  } else if (process.env.OPENREDIS_URL) {
    var redisUrl = parseUrl(process.env.OPENREDIS_URL);
    redisClient = redis.createClient(redisUrl.port, redisUrl.hostname);
    redisClient.auth(redisUrl.auth.split(":")[1]);
  } else {
    redisClient = redis.createClient();
  }

Yet session store uses different code

store: new RedisStore({
        host: process.env.REDIS_HOST || "localhost",
        port: process.env.REDIS_PORT || 6379
    })

hence app fails to start when using non-default settings for redis.

@ile
Copy link

ile commented Nov 2, 2014

I think RedisStore should be initialized like this?

var session = require('express-session');
var RedisStore = require('connect-redis')(session);

https://github.com/ilkkah/derby-starter/blob/master/lib/server.js#L6-L7

See usage:
https://github.com/tj/connect-redis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants