From ee63f1712e617555b6061df6ef1074accc8d67e0 Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Mon, 6 Jan 2014 00:11:37 +0200 Subject: [PATCH] moving out configuration items from express.js code to a proper configuration directive --- config/env/all.js | 8 +++++++- config/express.js | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/env/all.js b/config/env/all.js index f662ec59e1..6bf44396b7 100644 --- a/config/env/all.js +++ b/config/env/all.js @@ -6,5 +6,11 @@ var rootPath = path.normalize(__dirname + '/../..'); module.exports = { root: rootPath, port: process.env.PORT || 3000, - db: process.env.MONGOHQ_URL + db: process.env.MONGOHQ_URL, + + // The secret should be set to a non-guessable string that + // is used to compute a session hash + sessionSecret: 'MEAN', + // The name of the MongoDB collection to store sessions in + sessionCollection: 'sessions' } diff --git a/config/express.js b/config/express.js index fd70d93d90..3db729e53d 100755 --- a/config/express.js +++ b/config/express.js @@ -49,10 +49,10 @@ module.exports = function(app, passport, db) { // Express/Mongo session storage app.use(express.session({ - secret: 'MEAN', + secret: config.sessionSecret, store: new mongoStore({ db: db.connection.db, - collection: 'sessions' + collection: config.sessionCollection }) }));