mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Remove Sentry config from logger setup functions
The Sentry DSN key and environment are read from environment parameters/config in the logger modules.
This commit is contained in:
parent
f95702c313
commit
a75615707b
4 changed files with 13 additions and 18 deletions
|
|
@ -31,21 +31,19 @@ const fs = require('fs');
|
|||
const log = require('./log');
|
||||
|
||||
const buildPath = path.resolve(__dirname, '..', 'build');
|
||||
const ENV = process.env.NODE_ENV;
|
||||
const dev = process.env.NODE_ENV !== 'production';
|
||||
const PORT = process.env.PORT || 4000;
|
||||
const CLIENT_ID = process.env.REACT_APP_SHARETRIBE_SDK_CLIENT_ID ||
|
||||
'08ec69f6-d37e-414d-83eb-324e94afddf0';
|
||||
const BASE_URL = process.env.REACT_APP_SHARETRIBE_SDK_BASE_URL || 'http://localhost:8088';
|
||||
const ENFORCE_SSL = process.env.SERVER_SHARETRIBE_ENFORCE_SSL === 'true';
|
||||
const TRUST_PROXY = process.env.SERVER_SHARETRIBE_TRUST_PROXY || null;
|
||||
const SENTRY_DSN = process.env.SERVER_SENTRY_DSN;
|
||||
const dev = ENV !== 'production';
|
||||
const app = express();
|
||||
|
||||
const errorPage = fs.readFileSync(path.join(buildPath, '500.html'), 'utf-8');
|
||||
|
||||
// Setup error logger
|
||||
log.setup(SENTRY_DSN, ENV);
|
||||
log.setup();
|
||||
// Add logger request handler. In case Sentry is set up
|
||||
// request information is added to error context when sent
|
||||
// to Sentry.
|
||||
|
|
|
|||
|
|
@ -6,23 +6,21 @@
|
|||
|
||||
const Raven = require('raven');
|
||||
|
||||
// Sentry client key
|
||||
let SENTRY_DSN;
|
||||
const ENV = process.env.NODE_ENV;
|
||||
const SENTRY_DSN = process.env.SERVER_SENTRY_DSN;
|
||||
|
||||
/**
|
||||
* Set up error loggin. If a Sentry DSN is defined
|
||||
* Sentry client is configured.
|
||||
*/
|
||||
exports.setup = (sentryDsn, env) => {
|
||||
if (sentryDsn) {
|
||||
Raven.config(sentryDsn, {
|
||||
environment: env,
|
||||
exports.setup = () => {
|
||||
if (SENTRY_DSN) {
|
||||
Raven.config(SENTRY_DSN, {
|
||||
environment: ENV,
|
||||
autoBreadcrumbs: {
|
||||
http: true,
|
||||
},
|
||||
}).install();
|
||||
|
||||
SENTRY_DSN = sentryDsn;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ const setupStripe = () => {
|
|||
// If we're in a browser already, render the client application.
|
||||
if (typeof window !== 'undefined') {
|
||||
// set up logger with Sentry DSN client key and environment
|
||||
log.setup(config.sentryDsn, config.env);
|
||||
log.setup();
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
const preloadedState = window.__PRELOADED_STATE__ || '{}';
|
||||
|
|
|
|||
|
|
@ -7,16 +7,15 @@
|
|||
*/
|
||||
|
||||
import Raven from 'raven-js';
|
||||
import config from '../config';
|
||||
|
||||
/**
|
||||
* Set up error handling. If a Sentry DSN is
|
||||
* provided a Sentry client will be installed.
|
||||
*
|
||||
* @param {String} sentryDsn A public Sentry DSN
|
||||
*/
|
||||
export const setup = (sentryDsn, env) => {
|
||||
if (sentryDsn !== undefined) {
|
||||
Raven.config(sentryDsn, { environment: env }).install();
|
||||
export const setup = () => {
|
||||
if (config.sentryDsn !== undefined) {
|
||||
Raven.config(config.sentryDsn, { environment: config.env }).install();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue