|
|
|
@ -77,8 +77,7 @@ public class serverSwitch {
|
|
|
|
|
private ConcurrentMap<String, Integer> upnpPortMap = new ConcurrentHashMap<>();
|
|
|
|
|
private boolean isConnectedViaUpnp;
|
|
|
|
|
|
|
|
|
|
public serverSwitch(final File dataPath, final File appPath,
|
|
|
|
|
final String initPath, final String configPath) {
|
|
|
|
|
public serverSwitch(final File dataPath, final File appPath, final String initPath, final String configPath) {
|
|
|
|
|
// we initialize the switchboard with a property file,
|
|
|
|
|
// but maintain these properties then later in a new 'config' file
|
|
|
|
|
// to reset all changed configs, the config file must
|
|
|
|
@ -87,13 +86,10 @@ public class serverSwitch {
|
|
|
|
|
// file name of the config file
|
|
|
|
|
this.dataPath = dataPath;
|
|
|
|
|
this.appPath = appPath;
|
|
|
|
|
this.configComment = "This is an automatically generated file, updated by serverAbstractSwitch and initialized by "
|
|
|
|
|
+ initPath;
|
|
|
|
|
this.configComment = "This is an automatically generated file, updated by serverAbstractSwitch and initialized by " + initPath;
|
|
|
|
|
final File initFile = new File(appPath, initPath);
|
|
|
|
|
this.configFile = new File(dataPath, configPath); // propertiesFile(config);
|
|
|
|
|
this.firstInit = !this.configFile.exists(); // this is true if the
|
|
|
|
|
// application was started
|
|
|
|
|
// for the first time
|
|
|
|
|
this.firstInit = !this.configFile.exists(); // this is true if the application was started for the first time
|
|
|
|
|
new File(this.configFile.getParent()).mkdir();
|
|
|
|
|
|
|
|
|
|
// predefine init's
|
|
|
|
@ -111,6 +107,15 @@ public class serverSwitch {
|
|
|
|
|
this.configProps = new ConcurrentHashMap<String, String>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// overwrite configs with values from environment variables that start with "yacy_"
|
|
|
|
|
Properties sysprops = System.getProperties();
|
|
|
|
|
sysprops.forEach((key, value) -> {
|
|
|
|
|
String k = (String) key;
|
|
|
|
|
if (k.startsWith("yacy.")) {
|
|
|
|
|
this.configProps.put(k.substring(5), (String) value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// remove all values from config that do not appear in init
|
|
|
|
|
this.configRemoved = new ConcurrentHashMap<String, String>();
|
|
|
|
|
Iterator<String> i = this.configProps.keySet().iterator();
|
|
|
|
|