|
|
@ -65,7 +65,7 @@ debug("Importing Database");
|
|
|
|
const Database = require("./database");
|
|
|
|
const Database = require("./database");
|
|
|
|
|
|
|
|
|
|
|
|
debug("Importing Background Jobs");
|
|
|
|
debug("Importing Background Jobs");
|
|
|
|
const { initBackgroundJobs } = require("./jobs");
|
|
|
|
const { initBackgroundJobs, stopBackgroundJobs } = require("./jobs");
|
|
|
|
const { loginRateLimiter, twoFaRateLimiter } = require("./rate-limiter");
|
|
|
|
const { loginRateLimiter, twoFaRateLimiter } = require("./rate-limiter");
|
|
|
|
|
|
|
|
|
|
|
|
const { basicAuth } = require("./auth");
|
|
|
|
const { basicAuth } = require("./auth");
|
|
|
@ -137,7 +137,7 @@ const { statusPageSocketHandler } = require("./socket-handlers/status-page-socke
|
|
|
|
const databaseSocketHandler = require("./socket-handlers/database-socket-handler");
|
|
|
|
const databaseSocketHandler = require("./socket-handlers/database-socket-handler");
|
|
|
|
const TwoFA = require("./2fa");
|
|
|
|
const TwoFA = require("./2fa");
|
|
|
|
const StatusPage = require("./model/status_page");
|
|
|
|
const StatusPage = require("./model/status_page");
|
|
|
|
const { cloudflaredSocketHandler, autoStart: cloudflaredAutoStart } = require("./socket-handlers/cloudflared-socket-handler");
|
|
|
|
const { cloudflaredSocketHandler, autoStart: cloudflaredAutoStart, stop: cloudflaredStop } = require("./socket-handlers/cloudflared-socket-handler");
|
|
|
|
|
|
|
|
|
|
|
|
app.use(express.json());
|
|
|
|
app.use(express.json());
|
|
|
|
|
|
|
|
|
|
|
@ -1459,7 +1459,7 @@ exports.entryPage = "dashboard";
|
|
|
|
|
|
|
|
|
|
|
|
server.once("error", async (err) => {
|
|
|
|
server.once("error", async (err) => {
|
|
|
|
console.error("Cannot listen: " + err.message);
|
|
|
|
console.error("Cannot listen: " + err.message);
|
|
|
|
await Database.close();
|
|
|
|
await shutdownFunction();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
server.listen(port, hostname, () => {
|
|
|
|
server.listen(port, hostname, () => {
|
|
|
@ -1670,6 +1670,9 @@ async function shutdownFunction(signal) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await sleep(2000);
|
|
|
|
await sleep(2000);
|
|
|
|
await Database.close();
|
|
|
|
await Database.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stopBackgroundJobs();
|
|
|
|
|
|
|
|
await cloudflaredStop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function finalFunction() {
|
|
|
|
function finalFunction() {
|
|
|
|