From b7db7e0ec878c42488b143de5a5d124bdff3fa3f Mon Sep 17 00:00:00 2001 From: Wingysam Date: Thu, 22 Nov 2018 19:07:42 -0500 Subject: [PATCH] Add session max age --- config/index.js | 1 + index.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/index.js b/config/index.js index d52b1e7..16b4376 100644 --- a/config/index.js +++ b/config/index.js @@ -5,5 +5,6 @@ module.exports = { port: process.env.PORT || 3000, proxyServer: process.env.PROXY_SERVER || undefined, secret: process.env.SECRET || require('./secret'), + sessionMaxAge: Number(process.env.SESSION_MAX_AGE) || 1000 * 60 * 60 * 24 * 7, siteTitle: process.env.SITE_TITLE || 'Christmas Community' }; diff --git a/index.js b/index.js index 073959d..f2925cc 100644 --- a/index.js +++ b/index.js @@ -50,7 +50,10 @@ app.use(session({ secret: config.secret, resave: false, saveUninitialized: true, - store: new LevelStore(sessionDb) + store: new LevelStore(sessionDb), + cookie: { + maxAge: config.sessionMaxAge + } })); app.use(flash()); app.use(passport.initialize());