make launcher server optional

This commit is contained in:
wish
2022-08-23 18:38:13 +10:00
parent 6e7259a068
commit 8099c5fd66
3 changed files with 36 additions and 29 deletions

View File

@@ -5,6 +5,7 @@
"devmode": true,
"devmodeoptions": {
"serverName" : "",
"EnableLauncherServer": false,
"hideLoginNotice": false,
"loginNotice": "<BODY><CENTER><SIZE_3><C_4>Welcome to Erupe SU9 (Patch 1)!<BR><BODY><LEFT><SIZE_2><C_5>Erupe is experimental software<C_7>, we are not liable for any<BR><BODY>issues caused by installing the software!<BR><BODY><BR><BODY><C_4>■Report bugs on Discord!<C_7><BR><BODY><BR><BODY><C_4>■Test everything!<C_7><BR><BODY><BR><BODY><C_4>■Don't talk to softlocking NPCs!<C_7><BR><BODY><BR><BODY><C_4>■Fork the code on GitHub!<C_7><BR><BODY><BR><BODY>Thank you to all of the contributors,<BR><BODY><BR><BODY>this wouldn't exist without you.",
"cleandb": false,

View File

@@ -25,6 +25,7 @@ type Config struct {
// DevModeOptions holds various debug/temporary options for use while developing Erupe.
type DevModeOptions struct {
ServerName string // To get specific instance server about (Current Players/Event Week)
EnableLauncherServer bool // Enables the launcher server to be served on port 80
HideLoginNotice bool // Hide the Erupe notice on login
LoginNotice string // MHFML string of the login notice displayed
CleanDB bool // Automatically wipes the DB on server reset.

View File

@@ -125,7 +125,9 @@ func main() {
// Now start our server(s).
// Launcher HTTP server.
launcherServer := launcherserver.NewServer(
var launcherServer *launcherserver.Server
if erupeConfig.DevMode && erupeConfig.DevModeOptions.EnableLauncherServer {
launcherServer = launcherserver.NewServer(
&launcherserver.Config{
Logger: logger.Named("launcher"),
ErupeConfig: erupeConfig,
@@ -137,6 +139,7 @@ func main() {
preventClose(fmt.Sprintf("Failed to start launcher server: %s", err.Error()))
}
logger.Info("Started launcher server")
}
// Entrance server.
entranceServer := entranceserver.NewServer(
@@ -219,7 +222,9 @@ func main() {
}
signServer.Shutdown()
entranceServer.Shutdown()
if erupeConfig.DevModeOptions.EnableLauncherServer {
launcherServer.Shutdown()
}
time.Sleep(1 * time.Second)
}