diff --git a/Mage.Common/src/main/java/mage/utils/FluentBuilder.java b/Mage.Common/src/main/java/mage/utils/FluentBuilder.java index 3e4ab75b91..8c4174ac41 100644 --- a/Mage.Common/src/main/java/mage/utils/FluentBuilder.java +++ b/Mage.Common/src/main/java/mage/utils/FluentBuilder.java @@ -33,4 +33,4 @@ public abstract class FluentBuilder c.accept(instance)); return instance.makeValue(); } -} \ No newline at end of file +} diff --git a/Mage.Server/config/config_error.xml b/Mage.Server/config/config_error.xml index cf0b854367..51a73dee44 100644 --- a/Mage.Server/config/config_error.xml +++ b/Mage.Server/config/config_error.xml @@ -170,4 +170,4 @@ - \ No newline at end of file + diff --git a/Mage.Server/src/main/java/mage/server/Main.java b/Mage.Server/src/main/java/mage/server/Main.java index b2721b0639..49659adc4d 100644 --- a/Mage.Server/src/main/java/mage/server/Main.java +++ b/Mage.Server/src/main/java/mage/server/Main.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.MalformedURLException; import java.nio.charset.Charset; +import java.nio.file.Paths; import java.util.*; /** @@ -52,9 +53,11 @@ public final class Main { private static final String testModeArg = "-testMode="; private static final String fastDBModeArg = "-fastDbMode="; private static final String adminPasswordArg = "-adminPassword="; + private static final String configPathProp = "xmage.config.path"; private static final File pluginFolder = new File("plugins"); private static final File extensionFolder = new File("extensions"); + private static final String defaultConfigPath = Paths.get("config", "config.xml").toString(); public static final PluginClassLoader classLoader = new PluginClassLoader(); private static TransporterServer server; @@ -69,7 +72,6 @@ public final class Main { logger.info("Starting MAGE server version " + version); logger.info("Logging level: " + logger.getEffectiveLevel()); logger.info("Default charset: " + Charset.defaultCharset()); - final ConfigWrapper config = new ConfigWrapper(ConfigFactory.loadFromFile("config/config.xml")); String adminPassword = ""; for (String arg : args) { if (arg.startsWith(testModeArg)) { @@ -82,6 +84,13 @@ public final class Main { } } + final String configPath = Optional.ofNullable(System.getProperty(configPathProp)) + .orElse(defaultConfigPath); + + logger.info(String.format("Reading configuration from path=%s", configPath)); + final ConfigWrapper config = new ConfigWrapper(ConfigFactory.loadFromFile(configPath)); + + if (config.isAuthenticationActivated()) { logger.info("Check authorized user DB version ..."); if (!AuthorizedUserRepository.instance.checkAlterAndMigrateAuthorizedUser()) { diff --git a/Mage.Server/src/main/java/mage/server/UserManager.java b/Mage.Server/src/main/java/mage/server/UserManager.java index 8d33a80b68..d8e8574faa 100644 --- a/Mage.Server/src/main/java/mage/server/UserManager.java +++ b/Mage.Server/src/main/java/mage/server/UserManager.java @@ -40,7 +40,6 @@ public class UserManager implements IUserManager { private ExecutorService USER_EXECUTOR; - // TODO externalise start of threads public UserManager(ManagerFactory managerFactory) { this.managerFactory = managerFactory; }