-
Notifications
You must be signed in to change notification settings - Fork 21
/
app.ts
27 lines (26 loc) · 1007 Bytes
/
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
import { logger } from "./server/logger/Logger";
import { config } from "./server/config/Config";
import { webApp } from "./server/Server";
import { outQueues } from "./server/queues/outboundQueue";
import { njsPCRelay } from "./server/relay/relayRoute";
import * as readline from 'readline';
export function initAsync() {
return Promise.resolve()
.then(function () { config.init(); })
.then(function () { logger.init(); })
.then(function () { webApp.init(); })
.then(function () { outQueues.init(); })
}
export function stopAsync(): Promise<void> {
return Promise.resolve()
.then(function () { console.log('Shutting down open processes'); })
.then(function () { process.exit(); });
}
if (process.platform === 'win32') {
let rl = readline.createInterface({ input: process.stdin, output: process.stdout });
rl.on('SIGINT', function () { stopAsync(); });
}
else {
process.on('SIGINT', function () { return stopAsync(); });
}
initAsync();