Skip to content

Commit c13bd36

Browse files
authored
Remove unused env vars from Azure (#54036)
1 parent 201f7f7 commit c13bd36

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

src/frame/middleware/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,7 @@ export default function (app: Express) {
113113
}
114114

115115
// *** Observability ***
116-
// This DD_API_KEY is only being used to determine if the target
117-
// deployment environment is production. The key is not actually
118-
// used for sending data. Afer migrating to Moda, we can remove
119-
// the DD_API_KEY.
120-
if (process.env.DD_API_KEY || process.env.MODA_PROD_SERVICE_ENV) {
116+
if (process.env.MODA_PROD_SERVICE_ENV) {
121117
app.use(datadog)
122118
}
123119

src/observability/lib/statsd.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
import StatsD from 'hot-shots'
22

33
const {
4-
HEROKU_APP_NAME,
54
NODE_ENV,
6-
DD_API_KEY,
75
MODA_APP_NAME,
86
MODA_PROD_SERVICE_ENV,
97
KUBE_NODE_HOSTNAME,
108
DD_DOGSTATSD_PORT,
119
DD_AGENT_HOST,
1210
} = process.env
1311

14-
// This DD_API_KEY is only being used to determine if the target
15-
// deployment environment is production. The key is not actually
16-
// used for sending data. Afer migrating to Moda, we can remove
17-
// the DD_API_KEY.
18-
const isServiceEnvProduction = DD_API_KEY || MODA_PROD_SERVICE_ENV
19-
const mock = NODE_ENV === 'test' || !isServiceEnvProduction
12+
const mock = NODE_ENV === 'test' || !MODA_PROD_SERVICE_ENV
2013

2114
// MODA_APP_NAME gets set when the deploy target is Moda
2215
const modaApp = MODA_APP_NAME ? `moda_app_name:${MODA_APP_NAME}` : false
23-
// HEROKU_APP_NAME gets set when the deploy target is Azure
24-
const herokuApp = HEROKU_APP_NAME ? `heroku_app:${HEROKU_APP_NAME}` : false
2516

26-
export const tags = ['app:docs', modaApp, herokuApp].filter(Boolean)
17+
export const tags = ['app:docs', modaApp].filter(Boolean)
2718

2819
/**
2920
* @type {import('hot-shots').StatsD}

src/observability/middleware/handle-errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default async function handleError(
110110
}
111111

112112
// display error on the page in development and staging, but not in production
113-
if (process.env.HEROKU_PRODUCTION_APP !== 'true') {
113+
if (!process.env.MODA_PROD_SERVICE_ENV) {
114114
req.context.error = error
115115
}
116116

src/observability/middleware/trigger-error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function triggerError(
1515
// pattern used on async middleware! This is an intentional omission!
1616

1717
// prevent this from being used in production
18-
if (process.env.NODE_ENV === 'production' && process.env.HEROKU_PRODUCTION_APP) return next()
18+
if (process.env.NODE_ENV === 'production' && process.env.MODA_PROD_SERVICE_ENV) return next()
1919

2020
throw new Error('Intentional error')
2121
}

0 commit comments

Comments
 (0)