Merge pull request #19 from H4CK3R-01/monitoring_functions

Fixed server.js on local environments
This commit is contained in:
H4CK3R-01 2021-06-10 20:27:26 +02:00 committed by GitHub
commit fb3646e99d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,15 +13,21 @@ server.listen(port, function () {
}); });
// Monitor websockets // Monitor websockets
instrument(io, { if (process.env.WEBSOCKET_MONITOR_USERNAME && process.env.WEBSOCKET_MONITOR_PASSWORD) {
instrument(io, {
auth: { auth: {
type: "basic", type: "basic",
username: process.env.WEBSOCKET_MONITOR_USERNAME, username: process.env.WEBSOCKET_MONITOR_USERNAME,
password: process.env.WEBSOCKET_MONITOR_PASSWORD password: process.env.WEBSOCKET_MONITOR_PASSWORD
}, },
serverId: `${require("os").hostname()}#${process.pid}` serverId: `${require("os").hostname()}#${process.pid}`
}); });
} else {
instrument(io, {
auth: false,
serverId: `${require("os").hostname()}#${process.pid}`
});
}
// Serve static files (html, css, js) // Serve static files (html, css, js)
app.use(express.static(__dirname + '/../public')); app.use(express.static(__dirname + '/../public'));