-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
26 lines (21 loc) · 848 Bytes
/
app.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
const dotenv = require('dotenv')
dotenv.config()
let socketUrl = process.env.WS_ENDPOINT !== undefined ? process.env.WS_ENDPOINT : 'https://ws.retrobox.tech'
let consoleId = process.env.CONSOLE_ID !== undefined ? process.env.CONSOLE_ID : null
let consoleToken = process.env.CONSOLE_TOKEN !== undefined ? process.env.CONSOLE_TOKEN : null
if (!(process.getuid && process.getuid() === 0)) {
console.log('> ERR: not running as root user')
process.exit(1)
}
process
.on('unhandledRejection', (reason, p) => {
console.error(reason, 'Unhandled Rejection at Promise', p);
process.exit(1);
})
.on('uncaughtException', err => {
console.error(err, 'Uncaught Exception thrown');
process.exit(1);
});
const Overlay = require('./src/Overlay')
const overlay = new Overlay(socketUrl, consoleId, consoleToken)
overlay.connect()