Setting environment reported to Sentry separate from NODE_ENV

For preview and prod, NODE_ENV is "production"
This commit is contained in:
Jeff Avallone 2018-02-15 17:55:37 -05:00
parent f3e3e7922c
commit d634985698
3 changed files with 3 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import Raven from 'raven-js';
const setupRaven = () => { const setupRaven = () => {
Raven.config(process.env.SENTRY_KEY, { Raven.config(process.env.SENTRY_KEY, {
whitelistUrls: [/https:\/\/(.*\.)?regexper\.com/], whitelistUrls: [/https:\/\/(.*\.)?regexper\.com/],
environment: process.env.NODE_ENV, environment: process.env.DEPLOY_ENV,
debug: (process.env.NODE_ENV !== 'production'), debug: (process.env.NODE_ENV !== 'production'),
release: process.env.BUILD_ID release: process.env.BUILD_ID
}); });

View File

@ -15,7 +15,7 @@ describe('setupRaven', () => {
}); });
it('sets the environment', () => { it('sets the environment', () => {
process.env.NODE_ENV='test environment'; process.env.DEPLOY_ENV='test environment';
setupRaven(); setupRaven();
expect(Raven.config).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ expect(Raven.config).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({
environment: 'test environment' environment: 'test environment'

View File

@ -50,6 +50,7 @@ module.exports = {
plugins: [ plugins: [
new webpack.EnvironmentPlugin({ new webpack.EnvironmentPlugin({
NODE_ENV: 'development', NODE_ENV: 'development',
DEPLOY_ENV: 'development',
GA_PROPERTY: null, GA_PROPERTY: null,
SENTRY_KEY: null, SENTRY_KEY: null,
BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development'), BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development'),