From d8bf1c926c01431e50d6f18fc43f3ed4b117160c Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Wed, 16 Jan 2019 14:56:03 +0200 Subject: [PATCH] Update Sentry DSN related env variables and docs --- .env-template | 3 +-- docs/env.md | 3 +-- docs/sentry.md | 13 ++++++------- server/log.js | 2 +- src/config.js | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.env-template b/.env-template index 24066181..96bb7569 100644 --- a/.env-template +++ b/.env-template @@ -27,8 +27,7 @@ REACT_APP_ENV=production # REACT_APP_SHARETRIBE_USING_SSL=true # SERVER_SHARETRIBE_TRUST_PROXY=true -# REACT_APP_PUBLIC_SENTRY_DSN=change-me -# SERVER_SENTRY_DSN=change-me +# REACT_APP_SENTRY_DSN=change-me # REACT_APP_CSP=report # BASIC_AUTH_USERNAME=sharetribe # BASIC_AUTH_PASSWORD=secret diff --git a/docs/env.md b/docs/env.md index 59bda731..dc1bcae3 100644 --- a/docs/env.md +++ b/docs/env.md @@ -16,8 +16,7 @@ them have defaults that work for development environment. For production deploys | REACT_APP_ENV | A more fine grained env definition than NODE_ENV. Is used for example to differentiate envs in logging. | | REACT_APP_SHARETRIBE_USING_SSL | Redirect HTTP to HTTPS? | | SERVER_SHARETRIBE_TRUST_PROXY | Set when running the app behind a reverse proxy, e.g. in Heroku. | -| REACT_APP_PUBLIC_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) | -| SERVER_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) | +| REACT_APP_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) | | REACT_APP_CSP | See: [Content Security Policy (CSP)](./content-security-policy.md) | | BASIC_AUTH_USERNAME | Set to enable HTTP Basic Auth | | BASIC_AUTH_PASSWORD | Set to enable HTTP Basic Auth | diff --git a/docs/sentry.md b/docs/sentry.md index daa6e94a..d4b186dc 100644 --- a/docs/sentry.md +++ b/docs/sentry.md @@ -7,17 +7,16 @@ be used but the Sentry client comes already strapped into application. ## Setting up Sentry keys To enable the Sentry error logging a DSN, _Data Source Name_ has to be provided as an environment -variable. Browser and Node environments both require their own keys. The key names are as follows: +variable. Browser and Node environments use both the same key: -- **SERVER_SENTRY_DSN** - the private Sentry DSN, used on the server side -- **REACT_APP_PUBLIC_SENTRY_DSN** - the public Sentry DSN, used in the browser +- **REACT_APP_SENTRY_DSN** -The DSN keys can be aquired from the Sentry project settings. To test them in your local environment -they can be passed for example to the `yarn run dev-server` command: +The DSN key can be aquired from the Sentry project settings. To test it in your local environment it +can be passed for example to the `yarn run dev-server` command: - REACT_APP_PUBLIC_SENTRY_DSN='' SERVER_SENTRY_DSN='' yarn run dev-server + REACT_APP_SENTRY_DSN='' yarn run dev-server -If the Sentry DSN keys are not provided the template app will log errors to the console. The logging +If the Sentry DSN key is not provided the template app will log errors to the console. The logging and Sentry setup is implemented in [util/log.js](../src/util/log.js) and [server/log.js](../server/log.js) so refer to those files to change the external logging service or the logging logic in general. diff --git a/server/log.js b/server/log.js index 606bd7fe..6e3bdea7 100644 --- a/server/log.js +++ b/server/log.js @@ -7,7 +7,7 @@ const Sentry = require('@sentry/node'); const ENV = process.env.REACT_APP_ENV; -const SENTRY_DSN = process.env.SERVER_SENTRY_DSN; +const SENTRY_DSN = process.env.REACT_APP_SENTRY_DSN; /** * Set up error loggin. If a Sentry DSN is defined diff --git a/src/config.js b/src/config.js index 50da166f..089bd28e 100644 --- a/src/config.js +++ b/src/config.js @@ -62,7 +62,7 @@ const currency = process.env.REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY; const listingMinimumPriceSubUnits = 0; // Sentry DSN (Data Source Name), a client key for authenticating calls to Sentry -const sentryDsn = process.env.REACT_APP_PUBLIC_SENTRY_DSN; +const sentryDsn = process.env.REACT_APP_SENTRY_DSN; // If webapp is using SSL (i.e. it's behind 'https' protocol) const usingSSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true';