Update Sentry DSN related env variables and docs

This commit is contained in:
Jenni Nurmi 2019-01-16 14:56:03 +02:00
parent 21029f549e
commit d8bf1c926c
5 changed files with 10 additions and 13 deletions

View file

@ -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

View file

@ -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 |

View file

@ -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='<public-sentry-dsn>' SERVER_SENTRY_DSN='<private-sentry-dsn>' yarn run dev-server
REACT_APP_SENTRY_DSN='<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.

View file

@ -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

View file

@ -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';