mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
[app-wiring-refactor]: Externalise configuration path
This commit is contained in:
parent
d0c2135e17
commit
e8bb8ae24b
4 changed files with 12 additions and 4 deletions
|
@ -33,4 +33,4 @@ public abstract class FluentBuilder<ToBuild, RealBuilder extends FluentBuilder<T
|
|||
instance.buildSequence.forEach(c -> c.accept(instance));
|
||||
return instance.makeValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,4 +170,4 @@
|
|||
<deckType name="Block Constructed Custom - Star Wars" jar="mage-deck-constructed.jar" className="mage.deck.StarWarsBlock"/>
|
||||
<deckType name="Limited" jar="mage-deck-limited.jar" className="mage.deck.Limited"/>
|
||||
</deckTypes>
|
||||
</config>
|
||||
</config>
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue