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

Commit ee63f17

Browse files
committed
moving out configuration items from express.js code to a proper configuration directive
1 parent e2ea8da commit ee63f17

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

config/env/all.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@ var rootPath = path.normalize(__dirname + '/../..');
66
module.exports = {
77
root: rootPath,
88
port: process.env.PORT || 3000,
9-
db: process.env.MONGOHQ_URL
9+
db: process.env.MONGOHQ_URL,
10+
11+
// The secret should be set to a non-guessable string that
12+
// is used to compute a session hash
13+
sessionSecret: 'MEAN',
14+
// The name of the MongoDB collection to store sessions in
15+
sessionCollection: 'sessions'
1016
}

config/express.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ module.exports = function(app, passport, db) {
4949

5050
// Express/Mongo session storage
5151
app.use(express.session({
52-
secret: 'MEAN',
52+
secret: config.sessionSecret,
5353
store: new mongoStore({
5454
db: db.connection.db,
55-
collection: 'sessions'
55+
collection: config.sessionCollection
5656
})
5757
}));
5858

0 commit comments

Comments
 (0)