moving out configuration items from express.js code to a proper configuration directive

This commit is contained in:
Liran Tal
2014-01-06 00:11:37 +02:00
parent e2ea8dace9
commit ee63f1712e
2 changed files with 9 additions and 3 deletions

8
config/env/all.js vendored
View File

@@ -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'
}

View File

@@ -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
})
}));