From 5ae6f0bc1b889ab98151c713d44d1bd6ced86de6 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Thu, 3 Dec 2020 12:29:33 +1100 Subject: [PATCH] Added logging and preview options to .env --- .env | 4 +++- .env.preview | 5 ----- .env.production | 4 +++- src/helpers/logging.js | 6 +++--- src/index.js | 23 ++++++++++++----------- 5 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 .env.preview diff --git a/.env b/.env index 45a32c4..c91b12a 100644 --- a/.env +++ b/.env @@ -2,4 +2,6 @@ REACT_APP_BROKER_URL=http://localhost:9000 REACT_APP_ICE_SERVERS_URL=http://localhost:9000/iceservers REACT_APP_STRIPE_API_KEY=pk_test_8M3NHrF1eI2b84ubF4F8rSTe0095R3f0My REACT_APP_STRIPE_URL=http://localhost:9000 -REACT_APP_VERSION=$npm_package_version \ No newline at end of file +REACT_APP_VERSION=$npm_package_version +REACT_APP_PREVIEW=false +REACT_APP_LOGGING=false \ No newline at end of file diff --git a/.env.preview b/.env.preview deleted file mode 100644 index e0aeb80..0000000 --- a/.env.preview +++ /dev/null @@ -1,5 +0,0 @@ -REACT_APP_BROKER_URL=https://test.owlbear.rodeo -REACT_APP_ICE_SERVERS_URL=https://test.owlbear.rodeo/iceservers -REACT_APP_STRIPE_API_KEY=pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51 -REACT_APP_STRIPE_URL=https://payment.owlbear.rodeo -REACT_APP_VERSION=$npm_package_version \ No newline at end of file diff --git a/.env.production b/.env.production index e0aeb80..2fbd723 100644 --- a/.env.production +++ b/.env.production @@ -2,4 +2,6 @@ REACT_APP_BROKER_URL=https://test.owlbear.rodeo REACT_APP_ICE_SERVERS_URL=https://test.owlbear.rodeo/iceservers REACT_APP_STRIPE_API_KEY=pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51 REACT_APP_STRIPE_URL=https://payment.owlbear.rodeo -REACT_APP_VERSION=$npm_package_version \ No newline at end of file +REACT_APP_VERSION=$npm_package_version +REACT_APP_PREVIEW=true +REACT_APP_LOGGING=false \ No newline at end of file diff --git a/src/helpers/logging.js b/src/helpers/logging.js index 4b06f97..e8be741 100644 --- a/src/helpers/logging.js +++ b/src/helpers/logging.js @@ -2,7 +2,7 @@ import { captureException } from "@sentry/react"; export function logError(error) { console.error(error); - // if (process.env.NODE_ENV === "production") { - // captureException(error); - // } + if (process.env.REACT_APP_LOGGING === "true") { + captureException(error); + } } diff --git a/src/index.js b/src/index.js index 0ee1ee3..9083846 100644 --- a/src/index.js +++ b/src/index.js @@ -11,17 +11,18 @@ import * as serviceWorker from "./serviceWorker"; import "./index.css"; -console.log(process.env.NODE_ENV); - -// if (process.env.NODE_ENV === "production") { -// Sentry.init({ -// dsn: -// "https://bc1e2edfe7ca453f8e7357a48693979e@o467475.ingest.sentry.io/5493956", -// release: "owlbear-rodeo@" + process.env.REACT_APP_VERSION, -// // Ignore resize error as it is triggered by going fullscreen on slower computers -// ignoreErrors: ["ResizeObserver loop limit exceeded", "AbortError: QuotaExceededError"], -// }); -// } +if (process.env.REACT_APP_LOGGING === "true") { + Sentry.init({ + dsn: + "https://bc1e2edfe7ca453f8e7357a48693979e@o467475.ingest.sentry.io/5493956", + release: "owlbear-rodeo@" + process.env.REACT_APP_VERSION, + // Ignore resize error as it is triggered by going fullscreen on slower computers + ignoreErrors: [ + "ResizeObserver loop limit exceeded", + "AbortError: QuotaExceededError", + ], + }); +} Modal.setAppElement("#root");