diff --git a/server/index.js b/server/index.js index 959bfbe8..58bba691 100644 --- a/server/index.js +++ b/server/index.js @@ -33,7 +33,8 @@ const log = require('./log'); const { sitemapStructure } = require('./sitemap'); const buildPath = path.resolve(__dirname, '..', 'build'); -const dev = process.env.NODE_ENV !== 'production'; +const env = process.env.REACT_APP_ENV === undefined ? 'production' : process.env.REACT_APP_ENV; +const dev = process.env.REACT_APP_ENV === 'development'; const PORT = process.env.PORT || 4000; const CLIENT_ID = process.env.REACT_APP_SHARETRIBE_SDK_CLIENT_ID || '08ec69f6-d37e-414d-83eb-324e94afddf0'; diff --git a/server/log.js b/server/log.js index 708c7601..7a5655f0 100644 --- a/server/log.js +++ b/server/log.js @@ -6,7 +6,7 @@ const Raven = require('raven'); -const ENV = process.env.NODE_ENV; +const ENV = process.env.REACT_APP_ENV; const SENTRY_DSN = process.env.SERVER_SENTRY_DSN; /** diff --git a/src/config.js b/src/config.js index 91c57fff..856ac32e 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,5 @@ -const env = process.env.NODE_ENV; -const dev = env !== 'production'; +const env = process.env.REACT_APP_ENV === undefined ? 'production' : process.env.REACT_APP_ENV; +const dev = process.env.REACT_APP_ENV === 'development'; // To pass environment variables to the client app in the build // script, react-scripts (and the sharetribe-scripts fork of diff --git a/src/store.js b/src/store.js index b667e8f5..85a0e059 100644 --- a/src/store.js +++ b/src/store.js @@ -3,6 +3,7 @@ import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import createReducer from './reducers'; import * as analytics from './analytics/analytics'; +import config from './config'; /** * Create a new store with the given initial state. Adds Redux @@ -13,9 +14,7 @@ export default function configureStore(initialState = {}, sdk = null, analyticsH // Enable Redux Devtools in client side dev mode. const composeEnhancers = - process.env.NODE_ENV !== 'production' && - typeof window === 'object' && - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ + config.dev && typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose;