mirror of
https://github.com/correl/mage.git
synced 2024-11-29 03:00:12 +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
|
@ -39,6 +39,7 @@ import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,9 +53,11 @@ public final class Main {
|
||||||
private static final String testModeArg = "-testMode=";
|
private static final String testModeArg = "-testMode=";
|
||||||
private static final String fastDBModeArg = "-fastDbMode=";
|
private static final String fastDBModeArg = "-fastDbMode=";
|
||||||
private static final String adminPasswordArg = "-adminPassword=";
|
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 pluginFolder = new File("plugins");
|
||||||
private static final File extensionFolder = new File("extensions");
|
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();
|
public static final PluginClassLoader classLoader = new PluginClassLoader();
|
||||||
private static TransporterServer server;
|
private static TransporterServer server;
|
||||||
|
@ -69,7 +72,6 @@ public final class Main {
|
||||||
logger.info("Starting MAGE server version " + version);
|
logger.info("Starting MAGE server version " + version);
|
||||||
logger.info("Logging level: " + logger.getEffectiveLevel());
|
logger.info("Logging level: " + logger.getEffectiveLevel());
|
||||||
logger.info("Default charset: " + Charset.defaultCharset());
|
logger.info("Default charset: " + Charset.defaultCharset());
|
||||||
final ConfigWrapper config = new ConfigWrapper(ConfigFactory.loadFromFile("config/config.xml"));
|
|
||||||
String adminPassword = "";
|
String adminPassword = "";
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
if (arg.startsWith(testModeArg)) {
|
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()) {
|
if (config.isAuthenticationActivated()) {
|
||||||
logger.info("Check authorized user DB version ...");
|
logger.info("Check authorized user DB version ...");
|
||||||
if (!AuthorizedUserRepository.instance.checkAlterAndMigrateAuthorizedUser()) {
|
if (!AuthorizedUserRepository.instance.checkAlterAndMigrateAuthorizedUser()) {
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class UserManager implements IUserManager {
|
||||||
|
|
||||||
private ExecutorService USER_EXECUTOR;
|
private ExecutorService USER_EXECUTOR;
|
||||||
|
|
||||||
// TODO externalise start of threads
|
|
||||||
public UserManager(ManagerFactory managerFactory) {
|
public UserManager(ManagerFactory managerFactory) {
|
||||||
this.managerFactory = managerFactory;
|
this.managerFactory = managerFactory;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue