// process, our caller can use the appbase to download a new configuration file
_appbase = config.getString("appbase");
+ // see if locatorConfig override
+ if (locatorConfig != null && !StringUtil.isBlank(locatorConfig.getString("appbase"))) {
+ _appbase = locatorConfig.getString("appbase");
+ }
+
if (_appbase == null) {
throw new RuntimeException("m.missing_appbase");
}
public static void addStartupFile(String filename) {
_startupFiles.add(new File(filename));
}
-
private Config createLocatorConfig(Config.ParseOpts opts) {
if (_locatorFile == null) {
log.warning("Given locator file does not exist", "file", _locatorFile);
}
- // appbase is sanitised in HostWhitelist and here!
- Map<String, Object> tmpdata = new HashMap<>();
- tmpdata.put("appbase", tmpConfig.getString("appbase"));
- tmpdata.put("appargs", tmpConfig.getString("appargs"));
- tmpdata.put("jvmargs", tmpConfig.getString("jvmargs"));
- tmpdata.put(LOCATOR_FILE_EXTENSION+"replace", tmpConfig.getString(LOCATOR_FILE_EXTENSION+"replace"));
- tmpdata.put(LOCATOR_FILE_EXTENSION+"merge", tmpConfig.getString(LOCATOR_FILE_EXTENSION+"merge"));
- locatorConfig = new Config(tmpdata);
+ // appbase is sanitised in HostWhitelist
+ Map<String, Object> tmpData = new HashMap<>();
+ for (Map.Entry<String, Object> entry : tmpConfig.getData().entrySet()) {
+ String key = entry.getKey();
+ Object value = entry.getValue();
+ String mkey = key.indexOf('.') > -1 ? key.substring(key.indexOf('.') + 1) : key;
+ if (Config.allowedReplaceKeys.contains(mkey) || Config.allowedMergeKeys.contains(mkey)) {
+ tmpData.put(key, value);
+ }
+ }
+ locatorConfig = new Config(tmpData);
} catch (Exception e) {
log.warning("Failure reading locator file", "file", _locatorFile, e);
}
+ log.info("Returning locatorConfig", locatorConfig);
+
return locatorConfig;
}