mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FEATURE] Set netty bind port in first run
This commit is contained in:
parent
accbbe6b13
commit
992d31c883
1 changed files with 12 additions and 1 deletions
|
@ -241,11 +241,22 @@ public static void generateConfigIfNotExists(Path configFile, CommandHandler com
|
||||||
logger.error("ProjectName null. Using MineCraft");
|
logger.error("ProjectName null. Using MineCraft");
|
||||||
newConfig.projectName = "MineCraft";
|
newConfig.projectName = "MineCraft";
|
||||||
}
|
}
|
||||||
|
int port = 9274;
|
||||||
|
if(address.contains(":")) {
|
||||||
|
String portString = address.substring(address.indexOf(':')+1);
|
||||||
|
try {
|
||||||
|
port = Integer.parseInt(portString);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
logger.warn("Unknown port {}, using 9274", portString);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.info("Address {} doesn't contains port (you want to use nginx?)", address);
|
||||||
|
}
|
||||||
newConfig.netty.address = "ws://" + address + "/api";
|
newConfig.netty.address = "ws://" + address + "/api";
|
||||||
newConfig.netty.downloadURL = "http://" + address + "/%dirname%/";
|
newConfig.netty.downloadURL = "http://" + address + "/%dirname%/";
|
||||||
newConfig.netty.launcherURL = "http://" + address + "/Launcher.jar";
|
newConfig.netty.launcherURL = "http://" + address + "/Launcher.jar";
|
||||||
newConfig.netty.launcherEXEURL = "http://" + address + "/Launcher.exe";
|
newConfig.netty.launcherEXEURL = "http://" + address + "/Launcher.exe";
|
||||||
|
newConfig.netty.binds[0].port = port;
|
||||||
|
|
||||||
// Write LaunchServer config
|
// Write LaunchServer config
|
||||||
logger.info("Writing LaunchServer config file");
|
logger.info("Writing LaunchServer config file");
|
||||||
|
|
Loading…
Reference in a new issue