-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
56 lines (49 loc) · 1.2 KB
/
server.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
/* eslint-disable no-process-env */
'use strict';
const hof = require('hof');
const settings = require('./hof.settings');
settings.routes = settings.routes.map(route => require(route));
settings.root = __dirname;
settings.csp = {
fontSrc: [
'https://fonts.googleapis.com/'
],
scriptSrc: [
'https://tagmanager.google.com/',
'https://www.googletagmanager.com/'
],
imgSrc: [
'www.google-analytics.com',
'ssl.gstatic.com',
'www.google.co.uk/ads/ga-audiences'
],
connectSrc: [
'https://www.google-analytics.com',
'https://region1.google-analytics.com',
'https://region1.analytics.google.com'
]
};
/**
* Config variables needed for Google Tag Manager setup
*/
Object.assign(settings, {
gtm: {
config: {
event: 'pageLoad',
applicationType: 'ETA | Customer Contact',
environmentType: process.env.ENVIRONMENT || 'dev'
},
composePageName: function (page, convertPage) {
return 'ETA | Customer Contact | ' + convertPage(page);
}
}
});
if (process.env.REDIS_URL) {
settings.redis = process.env.REDIS_URL;
}
const app = hof(settings);
app.use((req, res, next) => {
res.locals.htmlLang = 'en';
next();
});
module.exports = app;