Skip to content

Commit

Permalink
Merge pull request #282 from HDRUK/UpdateSentry
Browse files Browse the repository at this point in the history
Sentry environment configuration
  • Loading branch information
PaulMcCaffertyPA authored Feb 26, 2021
2 parents 983b5af + 87c26a2 commit 16e9392
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ require('dotenv').config();

if (helper.getEnvironment() !== 'local') {
Sentry.init({
dsn: 'https://c7c564a153884dc0a6b676943b172121@o444579.ingest.sentry.io/5419637',
environment: helper.getEnvironment(),
});
dsn: "https://b6ea46f0fbe048c9974718d2c72e261b@o444579.ingest.sentry.io/5653683",
environment: helper.getEnvironment()
});
}

const Account = require('./account');
Expand Down
28 changes: 23 additions & 5 deletions src/resources/utilities/helper.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,30 @@ const _hidePrivateProfileDetails = persons => {
};

const _getEnvironment = () => {
let environment = 'local';
let environment = '';

if (process.env.environment === 'www') environment = 'prod';
else if (process.env.environment === 'uat') environment = 'uat';
else if (process.env.environment === 'uatbeta') environment = 'uatbeta';
else if (process.env.environment === 'latest') environment = 'latest';
switch (process.env.api_url) {
case 'https://api.latest.healthdatagateway.org':
environment = 'latest';
break;
case 'https://api.uatbeta.healthdatagateway.org':
environment = 'uatbeta';
break;
case 'https://api.uat.healthdatagateway.org':
environment = 'uat';
break;
case 'https://api.uat2.healthdatagateway.org':
environment = 'uat2';
break;
case 'https://api.preprod.healthdatagateway.org':
environment = 'preprod';
break;
case 'https://api.www.healthdatagateway.org':
environment = 'prod';
break;
default:
environment = 'local';
}

return environment;
};
Expand Down

0 comments on commit 16e9392

Please sign in to comment.