From 83d73b8882e877328581a8ab57935661a0df7249 Mon Sep 17 00:00:00 2001 From: Matt Creager Date: Thu, 28 Jan 2016 20:18:49 -0800 Subject: [PATCH 1/5] accept Mongo connection URI via the MONGOLAB_URI config var --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 85b6fb200a..b77518df2a 100644 --- a/index.js +++ b/index.js @@ -5,12 +5,14 @@ var express = require('express'); var ParseServer = require('parse-server').ParseServer; var http = require('http'); -if (!process.env.DATABASE_URI) { +var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI + +if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); } var api = new ParseServer({ - databaseURI: process.env.DATABASE_URI || 'mongodb://localhost:27017/dev', + databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: 'myAppId', masterKey: 'myMasterKey' From 042b5dfc92be609772b0c96b1075e76c5ac32078 Mon Sep 17 00:00:00 2001 From: Matt Creager Date: Thu, 28 Jan 2016 21:06:04 -0800 Subject: [PATCH 2/5] add app.json --- app.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app.json diff --git a/app.json b/app.json new file mode 100644 index 0000000000..884280329d --- /dev/null +++ b/app.json @@ -0,0 +1,15 @@ +{ + "name": "Parse Server Example", + "description": "An example Parse API server using the parse-server module", + "repository": "https://github.com/ParsePlatform/parse-server-example", + "logo": "https://avatars0.githubusercontent.com/u/1294580?v=3&s=200", + "keywords": ["node", "express", "parse"], + "env": { + "PARSE_MOUNT": { + "description": "Configure Parse API route.", + "value": "/parse" + } + }, + "image": "heroku/nodejs", + "addons": ["mongolab"] +} From a78eb268d9ffc7b5aed853000b5384336558ffb4 Mon Sep 17 00:00:00 2001 From: Matt Creager Date: Thu, 28 Jan 2016 21:08:07 -0800 Subject: [PATCH 3/5] update Heroku deploy section in readme --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5529765fff..943f0c346a 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,8 @@ Read the full server guide here: https://parse.com/docs/server/guide ### Getting Started With Heroku + Mongolab Development * Clone the repo and change directory to it -* Use the Heroku Toolbelt to log in and prepare the app -* Use the MongoLab addon: `heroku addons:create mongolab:sandbox` -* Use `heroku config` and note the URI provided by MongoLab under the var MONGOLAB_URI -* Copy this URI and set it as a new config variable: `heroku config:set DATABASE_URI=mongodb://...` +* Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create` +* Use the [MongoLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox` * By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `heroku config:set PARSE_MOUNT=/1` * Deploy it with: `git push heroku master` From 7f5585939478d1e8bc743cfec4f2077b178ddf42 Mon Sep 17 00:00:00 2001 From: Matt Creager Date: Thu, 28 Jan 2016 21:15:11 -0800 Subject: [PATCH 4/5] add the Heroku Button --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 943f0c346a..51252cade6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ Read the full server guide here: https://parse.com/docs/server/guide ### Getting Started With Heroku + Mongolab Development +#### With the Heroku Button + +[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) + +#### Without It + * Clone the repo and change directory to it * Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create` * Use the [MongoLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox` From b34e7f5832311cf8505fa967b7246afcb960999c Mon Sep 17 00:00:00 2001 From: Matt Creager Date: Fri, 29 Jan 2016 12:47:36 -0800 Subject: [PATCH 5/5] support additional config via env vars and button --- app.json | 8 ++++++++ index.js | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index 884280329d..a4b9a67dc3 100644 --- a/app.json +++ b/app.json @@ -8,6 +8,14 @@ "PARSE_MOUNT": { "description": "Configure Parse API route.", "value": "/parse" + }, + "APP_ID": { + "description": "A unique identifier for your app.", + "value": "myAppId" + }, + "MASTER_KEY": { + "description": "A key that overrides all permissions. Keep this secret.", + "value": "myMasterKey" } }, "image": "heroku/nodejs", diff --git a/index.js b/index.js index b77518df2a..aa0aed10e2 100644 --- a/index.js +++ b/index.js @@ -14,8 +14,8 @@ if (!databaseUri) { var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', - appId: 'myAppId', - masterKey: 'myMasterKey' + appId: process.env.APP_ID || 'myAppId', + masterKey: process.env.MASTER_KEY || 'myMasterKey' }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: