-
Notifications
You must be signed in to change notification settings - Fork 395
/
default.js
366 lines (316 loc) · 8.71 KB
/
default.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
// CONFIG defaults (aka PRODUCTION)
// WARNING: No test/stage/dev/development config should
// live here.
import path from 'path';
import { amoProdCDN, apiProdHost, baseUrlProd, sentryHost } from './lib/shared';
const appName = process.env.NODE_APP_INSTANCE || null;
const validAppNames = [
'amo',
'disco',
];
// Throw if the appName supplied is not valid.
if (appName && !validAppNames.includes(appName)) {
throw new Error(
`App "${appName}" is not enabled; valid app names: ${validAppNames}`);
}
module.exports = {
appName,
basePath: path.resolve(__dirname, '../'),
// The base URL of the site (for SEO purpose).
baseURL: baseUrlProd,
// These are reversed in src/core/client/config.js.
client: false,
server: true,
// Disables the server side render, handy for debugging.
disableSSR: false,
// 2592000 is 30 days in seconds.
cookieMaxAge: 2592000,
cookieName: 'frontend_auth_token',
cookieSecure: true,
// Enable devtools for: Redux.
enableDevTools: false,
// Logging level, see:
// https://github.com/pinojs/pino/blob/master/docs/API.md#parameters.
loggingLevel: 'info',
// Enable the httpContext/requestId middleware, see:
// https://github.com/mozilla/addons-frontend/issues/6537
enableRequestID: true,
// If true node will serve the static files.
enableNodeStatics: false,
enableStrictMode: true,
isDeployed: true,
isDevelopment: false,
// For all Firefox 57+ (Quantum) UAs, send the `appversion` in all API
// search requests. This will return only compatible add-ons, which is
// good for UX (it prevents a lot of incompatible old add-ons).
// Disable this in development when working with stage data, which is
// very out-of-date and mostly not 57+ compatible.
restrictSearchResultsToAppVersion: true,
// The canonical list of enabled apps.
validAppNames,
// The node server host and port.
serverHost: '127.0.0.1',
serverPort: 4000,
// By default, sending stats to DataDog is enabled but the host setting
// must also be non-empty.
useDatadog: true,
// These are set with environment variables.
datadogHost: null,
datadogPort: null,
// The CDN host for AMO.
amoCDN: amoProdCDN,
staticHost: amoProdCDN,
apiHost: apiProdHost,
apiPath: '/api/',
apiVersion: 'v4',
// The version for the favicon.
// This should be changed when a new favicon is pushed to the CDN to prevent
// client caching.
faviconVersion: 2,
// The keys listed here will be exposed on the client.
// Since by definition client-side code is public these config keys
// must not contain sensitive data.
//
// NOTE: when you update this, you may also have to update
// config/default-disco.js:clientConfigKeys
//
clientConfigKeys: [
'allowErrorSimulation',
'amoCDN',
'apiHost',
'apiPath',
'apiVersion',
'appName',
'authTokenValidFor',
'baseURL',
'cookieMaxAge',
'cookieName',
'cookieSecure',
'defaultLang',
'dismissedExperienceSurveyCookieName',
'enableDevTools',
'enableFeatureExperienceSurvey',
'enableFeatureHomeHeroGuides',
'enableFeatureStaticThemesForAndroid',
'enableRequestID',
'enableStrictMode',
'experiments',
'fxaConfig',
'hctEnabled',
'hrefLangsMap',
'isDeployed',
'isDevelopment',
'langMap',
'langs',
'loggingLevel',
'publicSentryDsn',
'restrictSearchResultsToAppVersion',
'rtlLangs',
'trackingEnabled',
'trackingId',
'trackingSendInitPageView',
'unsupportedHrefLangs',
'validClientAppUrlExceptions',
'validClientApplications',
'validLocaleUrlExceptions',
'validTrailingSlashUrlExceptions',
],
// Content Security Policy.
// NOTE: This config should be overridden on a per app basis
// if you're not updating the config for all apps.
// NOTE: if a config contains a var, consider importing it
// from ./lib/shared.js
CSP: {
directives: {
defaultSrc: ["'none'"],
baseUri: ["'self'"],
childSrc: ["'none'"],
connectSrc: [apiProdHost, sentryHost],
formAction: ["'none'"],
frameSrc: ["'none'"],
imgSrc: [
// Favicons are normally served
// from the document host.
"'self'",
amoProdCDN,
'data:',
],
mediaSrc: ["'none'"],
objectSrc: ["'none'"],
scriptSrc: [amoProdCDN],
styleSrc: [amoProdCDN],
reportUri: '/__cspreport__',
},
// Set to true if you only want browsers to report errors, not block them
reportOnly: false,
// Set to true if you want to blindly set all headers: Content-Security-Policy,
// X-WebKit-CSP, and X-Content-Security-Policy.
setAllHeaders: false,
// Set to true if you want to disable CSP on Android where it can be buggy.
disableAndroid: false,
},
frameGuard: {
action: 'deny',
},
// Supported languages.
langs: [
'af',
'ar',
'ast',
'az',
'bg',
'bn-BD',
'bs',
'ca',
'cak',
'cs',
'da',
'de',
'dsb',
'el',
'en-CA',
'en-GB',
'en-US',
'es',
'eu',
'fa',
'fi',
'fr',
'fy-NL',
'ga-IE',
'he',
'hsb',
'hu',
'ia',
'id',
'it',
'ja',
'ka',
'kab',
'ko',
'mk',
'mn',
'ms',
'nl',
'nb-NO',
'nn-NO',
'pl',
'pt-BR',
'pt-PT',
'ro',
'ru',
'sk',
'sl',
'sq',
'sv-SE',
'te',
'th',
'tr',
'uk',
'ur',
'vi',
'zh-CN',
'zh-TW',
],
// Exclusion list of unsupported locales for alternate links, see:
// https://github.com/mozilla/addons-frontend/issues/6644
unsupportedHrefLangs: [
'ast',
'cak',
'dsb',
'hsb',
'kab',
],
// Map of locale aliases for "alternate" links, see:
// https://github.com/mozilla/addons-frontend/issues/6644
hrefLangsMap: {
'x-default': 'en-US',
en: 'en-US',
pt: 'pt-PT',
},
// Map of short langs to longer ones.
langMap: {
en: 'en-US',
ga: 'ga-IE',
pt: 'pt-PT',
sv: 'sv-SE',
zh: 'zh-CN',
},
rtlLangs: ['ar', 'fa', 'he', 'ur'],
defaultLang: 'en-US',
// Some missing moment locales can be mapped to existing ones. Note: moment
// locales are lowercase and do not use an underscore.
// See: https://github.com/mozilla/addons-frontend/issues/1515
momentLangMap: {
'bn-bd': 'bn',
'fy-nl': 'fy',
'nb-no': 'nb',
'nn-no': 'nn',
'pt-pt': 'pt',
'sv-se': 'sv',
},
po2jsonFuzzyOutput: false,
enablePrefixMiddleware: true,
enableTrailingSlashesMiddleware: false,
localeDir: path.resolve(path.join(__dirname, '../locale')),
// This is off by default
// and enabled on a per-app basis.
trackingEnabled: false,
trackingId: null,
// send a page view on initialization.
trackingSendInitPageView: true,
// Hybrid Content Telemetry, off by default.
hctEnabled: false,
enablePostCssLoader: true,
// The list of valid client application names.
// These are derived from UA strings when not supplied in the URL.
validClientApplications: [
'android',
'firefox',
],
validLocaleUrlExceptions: [],
validClientAppUrlExceptions: [],
validTrailingSlashUrlExceptions: [],
clientAppRoutes: [],
// The default app used in the URL.
defaultClientApp: 'firefox',
// Dynamic JS chunk patterns to exclude. If these strings match any part of the JS file
// leaf name they will be excluded from being output in the HTML.
jsChunkExclusions: [
'i18n',
'disco-hct',
],
fxaConfig: null,
proxyEnabled: false,
// If true, enable a route that explicitly triggers a server error
// to test our internal error handler.
allowErrorSimulation: false,
sentryDsn: process.env.SENTRY_DSN || null,
publicSentryDsn: null,
// The amount of time (in seconds) that an auth token lives for. This is
// currently only used in AMO.
authTokenValidFor: null,
// The number of seconds the client should cache all responses for.
// If null, no caching headers will be sent.
// This setting is intended to simulate the Discopane's nginx cache
// header for development purposes.
cacheAllResponsesFor: null,
// See the Discopane config for how this is currently used.
discoParamsToUse: [],
// Feature flags.
//
// Please use the `enableFeature` prefix, see:
// https://github.com/mozilla/addons-frontend/issues/6362.
enableFeatureExperienceSurvey: false,
dismissedExperienceSurveyCookieName: 'dismissedExperienceSurvey',
enableFeatureHomeHeroGuides: false,
// This flag is enabled by default because the feature already exists and we
// want to disable it.
// See: https://github.com/mozilla/addons-frontend/issues/6689
enableFeatureStaticThemesForAndroid: true,
// The withExperiment HOC relies on this config to enable/disable A/B
// experiments.
experiments: {
installButtonColor: false,
},
};