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

mozilla / blurts-server / #13312

pending completion
#13312

push

circleci

jswinarton
MNTOR-1385 Basic backend flow for Premium featureset

Add the backend elements necessary to run the basic Premium subscription flow.

Some important notes:

    This creates two new routes, /oauth/premium/upgrade and /oauth/premium/confirmed, which drive the flow. They are not real views but are responsible for redirects and validation.
    The whole feature is behind a feature flag. Set FXA_SUBSCRIPTION_ENABLED=1 in your .env to enable.

282 of 1774 branches covered (15.9%)

Branch coverage included in aggregate %.

22 of 22 new or added lines in 4 files covered. (100.0%)

959 of 4683 relevant lines covered (20.48%)

1.71 hits per line

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

0.0
/src/appConstants.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
  'FXA_SUBSCRIPTION_ENABLED',
20
  'FXA_SUBSCRIPTION_KEY',
21
  'FXA_SUBSCRIPTION_PLAN_ID',
22
  'FXA_SUBSCRIPTION_PRODUCT_ID',
23
  'FXA_SUBSCRIPTION_URL',
24
  'HIBP_API_ROOT',
25
  'HIBP_KANON_API_ROOT',
26
  'HIBP_KANON_API_TOKEN',
27
  'HIBP_NOTIFY_TOKEN',
28
  'HIBP_THROTTLE_DELAY',
29
  'HIBP_THROTTLE_MAX_TRIES',
30
  'LOGOS_ORIGIN',
31
  'MAX_NUM_ADDRESSES',
32
  'MOZLOG_FMT',
33
  'MOZLOG_LEVEL',
34
  'NODE_ENV',
35
  'OAUTH_AUTHORIZATION_URI',
36
  'OAUTH_CLIENT_ID',
37
  'OAUTH_CLIENT_SECRET',
38
  'OAUTH_PROFILE_URI',
39
  'OAUTH_TOKEN_URI',
40
  'ONEREP_API_KEY',
41
  'REDIS_URL',
42
  'SENTRY_DSN',
43
  'SERVER_URL',
44
  'SES_CONFIG_SET',
45
  'SESSION_DURATION_HOURS',
46
  'SMTP_URL',
47
  'SUPPORTED_LOCALES'
48
]
49

50
const optionalEnvVars = [
×
51
  'FX_REMOTE_SETTINGS_WRITER_PASS',
52
  'FX_REMOTE_SETTINGS_WRITER_SERVER',
53
  'FX_REMOTE_SETTINGS_WRITER_USER',
54
  'EMAIL_TEST_RECIPIENT',
55
  'GA4_MEASUREMENT_ID',
56
  'GA4_DEBUG_MODE',
57
  'LIVE_RELOAD',
58
  'PORT',
59
  'SENTRY_DSN_LEGACY'
60
]
61

62
/** @type {Record<string, string>} */
63
const AppConstants = { }
×
64

65
if (!process.env.SERVER_URL && process.env.NODE_ENV === 'heroku') {
×
66
  process.env.SERVER_URL = `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`
×
67
}
68

69
for (const v of requiredEnvVars) {
×
70
  const value = process.env[v]
×
71
  if (value === undefined) {
×
72
    throw new Error(`Required environment variable was not set: ${v}`)
×
73
  }
74
  AppConstants[v] = value
×
75
}
76

77
optionalEnvVars.forEach(key => {
×
78
  const value = process.env[key]
×
79
  if (value) AppConstants[key] = value
×
80
})
81

82
export default AppConstants.NODE_ENV === 'test'
×
83
  ? AppConstants
84
  : 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