Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Broke off session configuration into own file
- Loading branch information
1 parent
0f5a0d8
commit 94153df
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |