• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / cf8b5ba0-2112-4304-8d33-763f70c4d58a

pending completion
cf8b5ba0-2112-4304-8d33-763f70c4d58a

push

circleci

GitHub
Merge pull request #2907 from mozilla/MNTOR-1321

282 of 1435 branches covered (19.65%)

Branch coverage included in aggregate %.

959 of 3916 relevant lines covered (24.49%)

4.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/app-constants.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
// TODO: these vars were copy/pasted from the old app-constants.js and should be cleaned up
6
import * as dotenv from 'dotenv'
7

8
dotenv.config({ path: '../.env' })
×
9

10
const requiredEnvVars = [
×
11
  'ADMINS',
12
  'COOKIE_SECRET',
13
  'CSRF_SECRET',
14
  'DATABASE_URL',
15
  'DELETE_UNVERIFIED_SUBSCRIBERS_TIMER',
16
  'EMAIL_FROM',
17
  'FXA_ENABLED',
18
  'FXA_SETTINGS_URL',
19
  'HIBP_API_ROOT',
20
  'HIBP_KANON_API_ROOT',
21
  'HIBP_KANON_API_TOKEN',
22
  'HIBP_NOTIFY_TOKEN',
23
  'HIBP_THROTTLE_DELAY',
24
  'HIBP_THROTTLE_MAX_TRIES',
25
  'LOGOS_ORIGIN',
26
  'MAX_NUM_ADDRESSES',
27
  'MOZLOG_FMT',
28
  'MOZLOG_LEVEL',
29
  'NODE_ENV',
30
  'OAUTH_AUTHORIZATION_URI',
31
  'OAUTH_CLIENT_ID',
32
  'OAUTH_CLIENT_SECRET',
33
  'OAUTH_PROFILE_URI',
34
  'OAUTH_TOKEN_URI',
35
  'REDIS_URL',
36
  'SENTRY_DSN',
37
  'SERVER_URL',
38
  'SES_CONFIG_SET',
39
  'SESSION_DURATION_HOURS',
40
  'SMTP_URL',
41
  'SUPPORTED_LOCALES'
42
]
43

44
const optionalEnvVars = [
×
45
  'FX_REMOTE_SETTINGS_WRITER_PASS',
46
  'FX_REMOTE_SETTINGS_WRITER_SERVER',
47
  'FX_REMOTE_SETTINGS_WRITER_USER',
48
  'EMAIL_TEST_RECIPIENT',
49
  'GA4_MEASUREMENT_ID',
50
  'LIVE_RELOAD',
51
  'PORT',
52
  'SENTRY_DSN_LEGACY'
53
]
54

55
const AppConstants = { }
×
56

57
if (!process.env.SERVER_URL && process.env.NODE_ENV === 'heroku') {
×
58
  process.env.SERVER_URL = `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`
×
59
}
60

61
for (const v of requiredEnvVars) {
×
62
  if (process.env[v] === undefined) {
×
63
    throw new Error(`Required environment variable was not set: ${v}`)
×
64
  }
65
  AppConstants[v] = process.env[v]
×
66
}
67

68
optionalEnvVars.forEach(key => {
×
69
  if (key in process.env) AppConstants[key] = process.env[key]
×
70
})
71

72
export default Object.freeze(AppConstants)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc