-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathserver.js
executable file
·29 lines (23 loc) · 940 Bytes
/
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
const appInsights = require('applicationinsights');
const CONF = require('@hmcts/properties-volume').addTo(require('config'));
const setupSecrets = require('app/core/setup/setupSecrets');
// Populate secrets from filesystem when not automated testing
if (CONF.environment !== 'testing') {
setupSecrets.setup();
}
const listenForConnections = true;
if (CONF.applicationInsights.instrumentationKey) {
appInsights.setup(CONF.applicationInsights.instrumentationKey)
.setAutoCollectConsole(true, true)
.setDistributedTracingMode(appInsights.DistributedTracingModes.AI_AND_W3C)
.setSendLiveMetrics(true)
.start();
appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.cloudRole] = 'div-pfe';
}
const app = require('./app');
const { http } = app.init(listenForConnections);
process.on('SIGTERM', () => {
http.close(() => {
process.exit(0); // eslint-disable-line no-process-exit
});
});