Skip to content

Commit

Permalink
Broke off session configuration into own file
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Feb 15, 2019
1 parent 0f5a0d8 commit 94153df
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/session.js
@@ -0,0 +1,25 @@
var redis = require("redis").createClient();
var config = require("config");
var session = require("express-session");
var Store = require("connect-redis")(session);

// Session settings
// It is important that session
// comes before the cache so we
// know what to serve to which user
var sessionOptions = {
secret: config.session.secret,
saveUninitialized: false,
resave: false,
proxy: true,
cookie: {
httpOnly: true,
secure: config.environment !== "development"
},
store: new Store({
client: redis,
port: config.redis.port
})
};

module.exports = session(sessionOptions);

0 comments on commit 94153df

Please sign in to comment.