-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
52 lines (41 loc) · 1.64 KB
/
app.ts
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
import * as fs from 'fs';
import logger from './src/utils/logger';
import config from './config';
import ServerManager from './src/httpserver/serverManager';
function displayLogo() {
if (config.application.hideLogo)
return;
try {
const logo = fs.readFileSync('./logo.txt', 'utf8');
console.log(logo);
console.log();
} catch (error) {
// ignore
}
}
function displayConfig() {
logger.info("Configuration: ");
logger.info(`> Application: `);
logger.info(`> > Log Level: ${config.application.logLevel}`);
logger.info(`> > Hide Logo: ${config.application.hideLogo}`);
logger.info(`> Web Server: `);
logger.info(`> > Port: ${config.webServer.port}`);
logger.info(`> > HTTP Path: ${config.webServer.httpPath}`);
logger.info(`> > WebSocket Path: ${config.webServer.wsPath}`);
logger.info(`> Traccar: `);
logger.info(`> > API Token: ${config.traccar.apiToken}`);
logger.info(`> > API Base URL: ${config.traccar.apiBaseUrl}`);
logger.info(`> > Websocket URL: ${config.traccar.websocketUrl}`);
logger.info(`> > Device UID: ${config.traccar.deviceUniqueId}`);
logger.info(`> > Fetch Interval: ${config.traccar.fetchInterval}`);
logger.info(`> OpenWeatherMap: `);
logger.info(`> > API Key: ${config.openweathermap.apiKey}`);
logger.info(`> > Fetch Interval: ${config.openweathermap.fetchInterval}`);
}
displayLogo();
displayConfig();
const serverManager = new ServerManager();
process.on('unhandledRejection', (reason, promise) => {
logger.error('Unhandled Rejection at:', promise, 'reason:', reason);
});
serverManager.startServer(config.webServer.port);