support to disableBaseEndpoint

This commit is contained in:
srgooglo 2022-06-22 17:12:52 +02:00
parent 81475ac8a3
commit 56c421848b

View File

@ -143,7 +143,7 @@ class Server {
// output server info // output server info
InternalConsole.log(`✅ Server is up and running!`) InternalConsole.log(`✅ Server is up and running!`)
this.InternalConsoleOutputServerInfo() this.OutputServerInfo()
// handle exit events // handle exit events
process.on("SIGTERM", this.cleanupProcess) process.on("SIGTERM", this.cleanupProcess)
@ -260,6 +260,11 @@ class Server {
} }
registerBaseEndpoints() { registerBaseEndpoints() {
if (this.params.disableBaseEndpoint) {
InternalConsole.warn("Base endpoint is disabled! Endpoints mapping will not be available, so linebridge client bridges will not work!")
return false
}
//* register main index endpoint `/` //* register main index endpoint `/`
// this is the default endpoint, should return the server info and the map of all endpoints (http & ws) // this is the default endpoint, should return the server info and the map of all endpoints (http & ws)
this.registerHTTPEndpoint({ this.registerHTTPEndpoint({
@ -390,7 +395,7 @@ class Server {
} }
// public methods // public methods
InternalConsoleOutputServerInfo = () => { OutputServerInfo = () => {
InternalConsole.log(`🌐 Server info:`) InternalConsole.log(`🌐 Server info:`)
InternalConsole.table({ InternalConsole.table({
"ID": this.id, "ID": this.id,