From d4dc6f2a284d9e0475bc46c9f423b2bcd90f6a0d Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Sun, 15 Oct 2017 16:37:10 -0700 Subject: [PATCH 1/2] separated bugsnag token --- app.json | 3 +++ server/static/index.html | 4 ++-- webpack.config.js | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index 557124d4..3f446c67 100644 --- a/app.json +++ b/app.json @@ -45,6 +45,9 @@ }, "URL": { "required": true + }, + "BUGSNAG_KEY": { + "required": true } }, "formation": {}, diff --git a/server/static/index.html b/server/static/index.html index e79463d5..3613c5c0 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -26,6 +26,6 @@
- + - + \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index f99b890c..5e33b37a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,6 +13,7 @@ const definePlugin = new webpack.DefinePlugin({ SLACK_REDIRECT_URI: JSON.stringify(process.env.SLACK_REDIRECT_URI), SLACK_KEY: JSON.stringify(process.env.SLACK_KEY), BASE_URL: JSON.stringify(process.env.URL), + BUGSNAG_KEY: JSON.stringify(process.env.BUGSNAG_KEY), DEPLOYMENT: JSON.stringify(process.env.DEPLOYMENT || 'hosted'), }); From 275e754bf1b2fd93378843daf430ef8b5d25886e Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Sun, 15 Oct 2017 16:51:25 -0700 Subject: [PATCH 2/2] Moved Bugsnag token into envvar --- .eslintrc | 20 ++++++-------------- flow-typed/globals.js | 1 + server/index.js | 4 ++-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.eslintrc b/.eslintrc index a1eb5ce4..239991f4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,10 +6,7 @@ "plugin:import/warnings", "plugin:flowtype/recommended" ], - "plugins": [ - "prettier", - "flowtype" - ], + "plugins": ["prettier", "flowtype"], "rules": { "eqeqeq": 2, "no-unused-vars": 2, @@ -22,7 +19,7 @@ "import/no-unresolved": [ "error", { - "ignore": [ "slate-drop-or-paste-images" ] + "ignore": ["slate-drop-or-paste-images"] } ], // Flow @@ -33,14 +30,8 @@ "annotationStyle": "line" } ], - "flowtype/space-after-type-colon": [ - 2, - "always" - ], - "flowtype/space-before-type-colon": [ - 2, - "never" - ], + "flowtype/space-after-type-colon": [2, "always"], + "flowtype/space-before-type-colon": [2, "never"], // Enforce that code is formatted with prettier. "prettier/prettier": [ "error", @@ -65,7 +56,8 @@ "SLACK_REDIRECT_URI": true, "DEPLOYMENT": true, "BASE_URL": true, + "BUGSNAG_KEY": true, "afterAll": true, "Bugsnag": true } -} \ No newline at end of file +} diff --git a/flow-typed/globals.js b/flow-typed/globals.js index c0951f95..37ccbbce 100644 --- a/flow-typed/globals.js +++ b/flow-typed/globals.js @@ -3,5 +3,6 @@ declare var __DEV__: string; declare var SLACK_REDIRECT_URI: string; declare var SLACK_KEY: string; declare var BASE_URL: string; +declare var BUGSNAG_KEY: ?string; declare var DEPLOYMENT: string; declare var Bugsnag: any; diff --git a/server/index.js b/server/index.js index ae6317b7..10c7bb92 100644 --- a/server/index.js +++ b/server/index.js @@ -65,8 +65,8 @@ if (process.env.NODE_ENV === 'development') { app.use(logger()); } -if (process.env.NODE_ENV === 'production') { - bugsnag.register('ad7a85f99b1b9324a31e16732cdf3192'); +if (process.env.NODE_ENV === 'production' && process.env.BUGSNAG_KEY) { + bugsnag.register(process.env.BUGSNAG_KEY); app.on('error', bugsnag.koaHandler); }