diff --git a/Procfile b/Procfile index 489b2700a..32dd1c83a 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: node server.js +web: ./node_modules/.bin/forever --minUptime 100 -c node server.js diff --git a/env.js b/env.js index 38f4822df..156ed9005 100644 --- a/env.js +++ b/env.js @@ -27,7 +27,7 @@ function config ( ) { } else { git.short(function record_git_head (head) { console.log("GIT HEAD", head); - env.head = head; + env.head = head || readENV("SCM_COMMIT_ID", ""); }); } env.version = software.version; @@ -45,7 +45,7 @@ function config ( ) { env.profile_collection = readENV('MONGO_PROFILE_COLLECTION', 'profile'); env.devicestatus_collection = readENV('MONGO_DEVICESTATUS_COLLECTION', 'devicestatus'); - env.enable = readENV('ENABLE'); + env.enable = readENV('ENABLE', ""); env.SSL_KEY = readENV('SSL_KEY'); env.SSL_CERT = readENV('SSL_CERT'); env.SSL_CA = readENV('SSL_CA'); diff --git a/lib/storage.js b/lib/storage.js index 58a965a7d..d5b128a05 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -11,6 +11,9 @@ function init (env, cb) { if (cb && cb.call) { cb(null, mongo); } return; } + if (!env.mongo) { + throw new Error("Mongo string is missing"); + } console.log("Connecting to mongo"); MongoClient.connect(env.mongo, function connected (err, db) { if (err) { diff --git a/package.json b/package.json index 8f1283ac7..fd31ca30e 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,8 @@ "sgvdata": "git://github.com/ktind/sgvdata.git#wip/protobuf", "socket.io": "^0.9.17", "git-rev": "git://github.com/bewest/git-rev.git", - "bootevent": "0.0.1" + "bootevent": "0.0.1", + "forever": "~0.13.0" }, "devDependencies": { "istanbul": "~0.3.5",