@ -79,7 +79,7 @@ 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" ) ;
log . debug ( "server" , "Importing Settings" ) ;
log . debug ( "server" , "Importing Settings" ) ;
const { getSettings , setSettings , setting , initJWTSecret , checkLogin , FBSD, doubleCheckPassword, startE2eTests ,
const { getSettings , setSettings , setting , initJWTSecret , checkLogin , doubleCheckPassword, startE2eTests ,
allowDevAllOrigin
allowDevAllOrigin
} = require ( "./util-server" ) ;
} = require ( "./util-server" ) ;
@ -104,20 +104,6 @@ const passwordHash = require("./password-hash");
const checkVersion = require ( "./check-version" ) ;
const checkVersion = require ( "./check-version" ) ;
log . info ( "server" , "Version: " + checkVersion . 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.
// Dual-stack support for (::)
// Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD
let hostEnv = FBSD ? null : process . env . HOST ;
let hostname = args . host || process . env . UPTIME _KUMA _HOST || hostEnv ;
if ( hostname ) {
log . info ( "server" , "Custom hostname: " + hostname ) ;
}
const port = [ args . port , process . env . UPTIME _KUMA _PORT , process . env . PORT , 3001 ]
. map ( portValue => parseInt ( portValue ) )
. find ( portValue => ! isNaN ( portValue ) ) ;
const disableFrameSameOrigin = ! ! process . env . UPTIME _KUMA _DISABLE _FRAME _SAMEORIGIN || args [ "disable-frame-sameorigin" ] || false ;
const disableFrameSameOrigin = ! ! process . env . UPTIME _KUMA _DISABLE _FRAME _SAMEORIGIN || args [ "disable-frame-sameorigin" ] || false ;
const cloudflaredToken = args [ "cloudflared-token" ] || process . env . UPTIME _KUMA _CLOUDFLARED _TOKEN || undefined ;
const cloudflaredToken = args [ "cloudflared-token" ] || process . env . UPTIME _KUMA _CLOUDFLARED _TOKEN || undefined ;
@ -182,7 +168,7 @@ let needSetup = false;
let setupDatabase = new SetupDatabase ( args , server ) ;
let setupDatabase = new SetupDatabase ( args , server ) ;
if ( setupDatabase . isNeedSetup ( ) ) {
if ( setupDatabase . isNeedSetup ( ) ) {
// Hold here and start a special setup page until user choose a database type
// Hold here and start a special setup page until user choose a database type
await setupDatabase . start ( hostname, port ) ;
await setupDatabase . start ( server. hostname, server . port ) ;
}
}
// Connect to database
// Connect to database
@ -1749,11 +1735,11 @@ let needSetup = false;
server . start ( ) ;
server . start ( ) ;
server . httpServer . listen ( port, hostname , ( ) => {
server . httpServer . listen ( server. port, server . hostname , ( ) => {
if ( hostname) {
if ( server. hostname) {
log . info ( "server" , ` Listening on ${ hostname} : ${ port } ` ) ;
log . info ( "server" , ` Listening on ${ server. hostname} : ${ server . port } ` ) ;
} else {
} else {
log . info ( "server" , ` Listening on ${ port} ` ) ;
log . info ( "server" , ` Listening on ${ server. port} ` ) ;
}
}
startMonitors ( ) ;
startMonitors ( ) ;
checkVersion . startInterval ( ) ;
checkVersion . startInterval ( ) ;