Skip to content

Commit c766ec5

Browse files
committed
Add env vars from netlify
1 parent 2be4003 commit c766ec5

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

frontend/.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"node": true
88
},
99
"globals": {
10-
"__DEV__": true
10+
"__DEV__": true,
11+
"__DELPOY_ENV__": true,
12+
"__GIT_SHA__": true,
13+
"__BRANCH__": true
1114
},
1215
"settings": {
1316
"import/resolver": {

frontend/src/datadog.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ datadogRum.init({
4444
clientToken: 'pub2b91b53e324deaa20ce2c3738fc4f9aa',
4545
site: 'datadoghq.com',
4646
service: 'fourtiesnyc',
47-
env: __DEV__ ? 'dev' : 'prod',
47+
env: __DEPLOY_ENV__ || 'dev',
48+
version: __GIT_SHA__,
4849
// Explicitly enable manual view tracking for RRv5
4950
trackViewsManually: true,
5051
defaultPrivacyLevel: 'mask-user-input',
5152
// plugins: [reactPlugin({ router: false })], // Keep disabled until upgrading React Router due to deps conflict
5253
});
54+
datadogRum.addRumGlobalContext('branch', __BRANCH__);

frontend/src/globals.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ declare let __LOCALE__: string;
33
declare let __API_BASE__: string;
44
declare let __STRIPE_PK__: string;
55
declare let __RECAPTCHA_PK__: string;
6+
declare let __DEPLOY_ENV__:
7+
| 'production'
8+
| 'deploy-preview'
9+
| 'branch-deploy'
10+
| 'dev';
11+
declare let __GIT_SHA__: string;
12+
declare let __BRANCH__: string;
613

714
interface Window {
815
dataLayer?: Record<string, unknown>[];

frontend/webpack.prod.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const webpack = require('webpack');
33
const merge = require('webpack-merge');
44
const common = require('./webpack.common.js');
55
const HtmlWebpackPlugin = require('html-webpack-plugin');
6-
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
6+
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
77

88
const path = require('path');
99

@@ -22,6 +22,9 @@ module.exports = merge(common, {
2222
__API_BASE__: JSON.stringify(process.env.API_BASE),
2323
__STRIPE_PK__: JSON.stringify(process.env.STRIPE_PK),
2424
__RECAPTCHA_PK__: JSON.stringify(process.env.RECAPTCHA_PK),
25+
__DEPLOY_ENV__: JSON.stringify(process.env.CONTEXT),
26+
__GIT_SHA__: JSON.stringify(process.env.COMMIT_REF),
27+
__BRANCH__: JSON.stringify(process.env.BRANCH),
2528
}),
2629
new HtmlWebpackPlugin({
2730
template: path.join(path.resolve(__dirname, 'src'), 'app.html'),
@@ -32,8 +35,8 @@ module.exports = merge(common, {
3235
},
3336
}),
3437
new SentryWebpackPlugin({
35-
org: "julian-boilen",
36-
project: "fourtiesnyc-frontend",
38+
org: 'julian-boilen',
39+
project: 'fourtiesnyc-frontend',
3740

3841
// Specify the directory containing build artifacts
3942
include: path.resolve(__dirname, 'dist'),

0 commit comments

Comments
 (0)