@ -39,7 +39,6 @@ if (!semver.satisfies(nodeVersion, requiredNodeVersions)) {
const args = require ( "args-parser" ) ( process . argv ) ;
const args = require ( "args-parser" ) ( process . argv ) ;
const { sleep , log , getRandomInt , genSecret , isDev } = require ( "../src/util" ) ;
const { sleep , log , getRandomInt , genSecret , isDev } = require ( "../src/util" ) ;
log . info ( "server" , "Welcome to Uptime Kuma" ) ;
log . debug ( "server" , "Arguments" ) ;
log . debug ( "server" , "Arguments" ) ;
log . debug ( "server" , args ) ;
log . debug ( "server" , args ) ;
@ -47,8 +46,13 @@ if (! process.env.NODE_ENV) {
process . env . NODE _ENV = "production" ;
process . env . NODE _ENV = "production" ;
}
}
log . info ( "server" , "Node Env: " + process . env . NODE _ENV ) ;
log . info ( "server" , "Env: " + process . env . NODE _ENV ) ;
log . info ( "server" , "Inside Container: " + ( process . env . UPTIME _KUMA _IS _CONTAINER === "1" ) ) ;
log . debug ( "server" , "Inside Container: " + ( process . env . UPTIME _KUMA _IS _CONTAINER === "1" ) ) ;
const checkVersion = require ( "./check-version" ) ;
log . info ( "server" , "Uptime Kuma Version: " + checkVersion . version ) ;
log . info ( "server" , "Loading modules" ) ;
log . debug ( "server" , "Importing express" ) ;
log . debug ( "server" , "Importing express" ) ;
const express = require ( "express" ) ;
const express = require ( "express" ) ;
@ -75,7 +79,6 @@ const server = UptimeKumaServer.getInstance(args);
const io = module . exports . io = server . io ;
const io = module . exports . io = server . io ;
const app = server . app ;
const app = server . app ;
log . info ( "server" , "Importing this project modules" ) ;
log . debug ( "server" , "Importing Monitor" ) ;
log . debug ( "server" , "Importing Monitor" ) ;
const Monitor = require ( "./model/monitor" ) ;
const Monitor = require ( "./model/monitor" ) ;
const User = require ( "./model/user" ) ;
const User = require ( "./model/user" ) ;
@ -102,9 +105,6 @@ const { apiAuth } = require("./auth");
const { login } = require ( "./auth" ) ;
const { login } = require ( "./auth" ) ;
const passwordHash = require ( "./password-hash" ) ;
const passwordHash = require ( "./password-hash" ) ;
const checkVersion = require ( "./check-version" ) ;
log . info ( "server" , "Version: " + checkVersion . version ) ;
// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise.
// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise.
// Dual-stack support for (::)
// Dual-stack support for (::)
// Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD
// Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD
@ -195,7 +195,7 @@ let needSetup = false;
server . entryPage = await Settings . get ( "entryPage" ) ;
server . entryPage = await Settings . get ( "entryPage" ) ;
await StatusPage . loadDomainMappingList ( ) ;
await StatusPage . loadDomainMappingList ( ) ;
log . info ( "server" , "Adding route" ) ;
log . debug ( "server" , "Adding route" ) ;
// ***************************
// ***************************
// Normal Router here
// Normal Router here
@ -295,7 +295,7 @@ let needSetup = false;
}
}
} ) ;
} ) ;
log . info ( "server" , "Adding socket handler" ) ;
log . debug ( "server" , "Adding socket handler" ) ;
io . on ( "connection" , async ( socket ) => {
io . on ( "connection" , async ( socket ) => {
sendInfo ( socket , true ) ;
sendInfo ( socket , true ) ;
@ -1735,11 +1735,12 @@ let needSetup = false;
} ) ;
} ) ;
log . info ( "server" , "Init the server" ) ;
log . debug ( "server" , "Init the server" ) ;
server . httpServer . once ( "error" , async ( err ) => {
server . httpServer . once ( "error" , async ( err ) => {
console. error ( "Cannot listen: " + err . message ) ;
log. error ( "server" , "Cannot listen: " + err . message ) ;
await shutdownFunction ( ) ;
await shutdownFunction ( ) ;
process . exit ( 1 ) ;
} ) ;
} ) ;
server . start ( ) ;
server . start ( ) ;
@ -1851,9 +1852,9 @@ async function afterLogin(socket, user) {
* @ returns { Promise < void > }
* @ returns { Promise < void > }
* /
* /
async function initDatabase ( testMode = false ) {
async function initDatabase ( testMode = false ) {
log . info( "server" , "Connecting to the D atabase") ;
log . debug( "server" , "Connecting to the d atabase") ;
await Database . connect ( testMode ) ;
await Database . connect ( testMode ) ;
log . info ( "server" , "Connected ") ;
log . info ( "server" , "Connected to the database ") ;
// Patch the database
// Patch the database
await Database . patch ( ) ;
await Database . patch ( ) ;
@ -1867,7 +1868,7 @@ async function initDatabase(testMode = false) {
jwtSecretBean = await initJWTSecret ( ) ;
jwtSecretBean = await initJWTSecret ( ) ;
log . info ( "server" , "Stored JWT secret into database" ) ;
log . info ( "server" , "Stored JWT secret into database" ) ;
} else {
} else {
log . info ( "server" , "Load JWT secret from database." ) ;
log . debug ( "server" , "Load JWT secret from database." ) ;
}
}
// If there is no record in user table, it is a new Uptime Kuma instance, need to setup
// If there is no record in user table, it is a new Uptime Kuma instance, need to setup