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());