aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-21 03:21:16 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-21 03:21:16 +0800
commitac1ffe53df90df9ecf4aca972a5625568f0b2a3a (patch)
tree352e0fa757ae08b5b717e076ef33d73b609c3e0d
parentba41fc9275bebe17577f87d72f54b7e7dc420acc (diff)
downloaddexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.tar
dexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.tar.gz
dexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.tar.bz2
dexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.tar.lz
dexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.tar.xz
dexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.tar.zst
dexon-sol-tools-ac1ffe53df90df9ecf4aca972a5625568f0b2a3a.zip
Send in rollbar environment
-rw-r--r--packages/instant/webpack.config.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
index 41276809c..161e7d1b0 100644
--- a/packages/instant/webpack.config.js
+++ b/packages/instant/webpack.config.js
@@ -11,21 +11,31 @@ const GIT_SHA = childProcess
.toString()
.trim();
-const HEAP_PRODUCTION_ENV_VAR_NAME = 'INSTANT_HEAP_ANALYTICS_ID_PRODUCTION';
-const HEAP_DEVELOPMENT_ENV_VAR_NAME = 'INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT';
-const getHeapAnalyticsId = modeName => {
- if (modeName === 'production') {
- return process.env[HEAP_PRODUCTION_ENV_VAR_NAME];
+const getEnvironmentName = (env, argv) => {
+ if (env && env.dogfood) {
+ return 'dogfood';
+ } else if (env && env.staging) {
+ return 'staging';
}
- if (modeName === 'development') {
- return process.env[HEAP_DEVELOPMENT_ENV_VAR_NAME];
+ // argv.mode should be 'development' or 'production'
+ return argv.mode;
+};
+
+const getHeapAnalyticsId = environmentName => {
+ if (environmentName === 'production') {
+ return process.env['INSTANT_HEAP_ANALYTICS_ID_PRODUCTION'];
+ }
+
+ if (environmentName === 'development' || environmentName === 'dogfood' || environmentName === 'staging') {
+ return process.env['INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT'];
}
return undefined;
};
module.exports = (env, argv) => {
+ const environmentName = getEnvironmentName(env, argv);
const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd';
const config = {
entry: {
@@ -41,8 +51,10 @@ module.exports = (env, argv) => {
new webpack.DefinePlugin({
'process.env': {
GIT_SHA: JSON.stringify(GIT_SHA),
- HEAP_ANALYTICS_ID: getHeapAnalyticsId(argv.mode),
NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
+ HEAP_ANALYTICS_ID: getHeapAnalyticsId(environmentName),
+ ROLLBAR_ENVIRONMENT: JSON.stringify(environmentName),
+ ROLLBAR_CLIENT_TOKEN: JSON.stringify(process.env.INSTANT_ROLLBAR_CLIENT_TOKEN),
},
}),
],