Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 0aa5e68

Browse files
committed
Adding support for configurable session expiration time
1 parent d9a8647 commit 0aa5e68

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

config/env/default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module.exports = {
1010
port: process.env.PORT || 3000,
1111
templateEngine: 'swig',
1212
// Session details
13+
// session expiration is set by default to 24 hours
14+
sessionExpiration: 24 * (60 * 1000),
1315
// sessionSecret should be changed for security measures and concerns
1416
sessionSecret: 'MEAN',
1517
// sessionKey is set to the generic sessionId key used by PHP applications

config/lib/express.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ module.exports.initSession = function (app, db) {
115115
saveUninitialized: true,
116116
resave: true,
117117
secret: config.sessionSecret,
118+
cookie: {
119+
maxAge: config.sessionExpiration
120+
},
118121
key: config.sessionKey,
119122
store: new MongoStore({
120123
mongooseConnection: db.connection,

0 commit comments

Comments
 (0)