-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
21 lines (19 loc) · 838 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require('dotenv').config();
const encryption = require('./lib/encryption');
const port = process.env.PORT || 8000;
//This timeout is used to delay accepting connections until the server is fully loaded.
//It could come to a crash if a request comes in before the settings cache was fully laoded.
setTimeout(() => {
const app = require('./src/app');
const { logger } = require('./lib/logger');
setTimeout(() => {
if (process.env.ExtraErrorWebDelay > 0) {
logger('info', `Webserver was delayed by ${process.env.ExtraErrorWebDelay || 500}ms beause of a error.`);
}
app.listen(port, () => {
/* eslint-disable no-console */
logger('system', `Server started on port ${port}`);
/* eslint-enable no-console */
});
}, process.env.ExtraErrorWebDelay || 500);
}, process.env.GlobalWaitTime || 500);