try latest connect-mongo with a mongostore initialization callback in

attempt to avoid the 'arbiterOnly' error
This commit is contained in:
Tyler Renelle 2012-12-28 10:06:15 -05:00
parent 9db1d7c17e
commit 9d80ffcf3c
2 changed files with 39 additions and 35 deletions

View file

@ -10,7 +10,7 @@
"derby-ui-boot": "git://github.com/codeparty/derby-ui-boot#master",
"derby-auth": "git://github.com/lefnire/derby-auth#master",
"connect-mongo": ">=0.1.9",
"connect-mongo": "git://github.com/kcbanner/connect-mongo#master",
"passport-facebook": "*",
"express": "*",
"gzippo": "*",

View file

@ -51,6 +51,10 @@ options =
allowPurl: true
schema: require('../app/schema').newUserObject()
# use async callback for initializing app, to make sure we're connected to the database before initting app
# this avoids 'arbiterOnly' error (see http://goo.gl/Vs6lW)
mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, ->
expressApp
.use(express.favicon())
# Gzip static files and serve from memory
@ -68,7 +72,7 @@ expressApp
.use(store.sessionMiddleware
secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE'
cookie: {maxAge: ONE_YEAR}
store: new MongoStore(url: process.env.NODE_DB_URI)
store: mongo_store
)
# Adds req.getModel method