|
|
@ -18,6 +18,10 @@ import engine.server.login.LoginServer; |
|
|
|
import engine.server.world.WorldServer; |
|
|
|
import engine.server.world.WorldServer; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
@ -107,11 +111,13 @@ public enum ConfigManager { |
|
|
|
public static LoginServer loginServer; |
|
|
|
public static LoginServer loginServer; |
|
|
|
public static Map<ConfigManager, Pattern> regex = new HashMap<>(); |
|
|
|
public static Map<ConfigManager, Pattern> regex = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String currentRepoBranch = ""; |
|
|
|
|
|
|
|
|
|
|
|
// Called at bootstrap: ensures that all config values are loaded.
|
|
|
|
// Called at bootstrap: ensures that all config values are loaded.
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean init() { |
|
|
|
public static boolean init() { |
|
|
|
|
|
|
|
|
|
|
|
Logger.info("Loading config from environment..."); |
|
|
|
Logger.info("Loading config from environment."); |
|
|
|
|
|
|
|
|
|
|
|
for (ConfigManager configSetting : ConfigManager.values()) |
|
|
|
for (ConfigManager configSetting : ConfigManager.values()) |
|
|
|
if (configMap.containsKey(configSetting.name())) |
|
|
|
if (configMap.containsKey(configSetting.name())) |
|
|
@ -123,6 +129,32 @@ public enum ConfigManager { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("Determine current Repo branch"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File file = new File("mbbranch.sh"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (file.exists() && !file.isDirectory()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] command = {"./mbbranch"}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Process process = Runtime.getRuntime().exec(command); |
|
|
|
|
|
|
|
BufferedReader reader = new BufferedReader(new InputStreamReader( |
|
|
|
|
|
|
|
process.getInputStream())); |
|
|
|
|
|
|
|
String string; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
if ((string = reader.readLine()) == null) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
currentRepoBranch += string; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// compile regex here
|
|
|
|
// compile regex here
|
|
|
|
|
|
|
|
|
|
|
|
Logger.info("Compiling regex"); |
|
|
|
Logger.info("Compiling regex"); |
|
|
|