diff --git a/server/server.js b/server/server.js index 90ec53290..5e704c33c 100644 --- a/server/server.js +++ b/server/server.js @@ -1541,6 +1541,11 @@ async function afterLogin(socket, user) { } } +/** + * Connect to the database and patch it if necessary. + * + * Generated by Trelent + */ async function initDatabase(testMode = false) { if (! fs.existsSync(Database.path)) { log.info("server", "Copying Database"); diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index cc77bb186..1cc740646 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -4,6 +4,7 @@ const fs = require("fs"); const http = require("http"); const { Server } = require("socket.io"); const { R } = require("redbean-node"); +const { log } = require("../src/util"); /** * `module.exports` (alias: `server`) should be inside this class, in order to avoid circular dependency issue. @@ -36,20 +37,20 @@ class UptimeKumaServer { constructor(args) { // SSL - const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined; - const sslCert = process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || args["ssl-cert"] || undefined; + const sslKey = args["ssl-key"] || process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || undefined; + const sslCert = args["ssl-cert"] || process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || undefined; - console.log("Creating express and socket.io instance"); + log.info("server", "Creating express and socket.io instance"); this.app = express(); if (sslKey && sslCert) { - console.log("Server Type: HTTPS"); + log.info("server", "Server Type: HTTPS"); this.httpServer = https.createServer({ key: fs.readFileSync(sslKey), cert: fs.readFileSync(sslCert) }, this.app); } else { - console.log("Server Type: HTTP"); + log.info("server", "Server Type: HTTP"); this.httpServer = http.createServer(this.app); } @@ -62,6 +63,13 @@ class UptimeKumaServer { return list; } + /** + * Get a list of monitors for the given user. + * @param {string} userID - The ID of the user to get monitors for. + * @returns {Promise} A promise that resolves to an object with monitor IDs as keys and monitor objects as values. + * + * Generated by Trelent + */ async getMonitorJSONList(userID) { let result = {};