Use a "sys." prefix instead of custom parsing.

This commit is contained in:
Michael Bayne
2018-11-26 13:09:43 -08:00
parent 0bd22aaacc
commit 9dd8285243
2 changed files with 13 additions and 14 deletions
+4
View File
@@ -8,6 +8,10 @@
* Added `max_concurrent_downloads` setting to `getdown.txt`. Controls what you would expect. * Added `max_concurrent_downloads` setting to `getdown.txt`. Controls what you would expect.
Defaults to two. Defaults to two.
* `bootstrap.properties` can now contain system properties which will be set prior to running
Getdown. They must be prefixed by `sys.`: for example `sys.silent = true` will set the `silent`
system property to `true`.
* Fixed issue with `appid` not being properly used when specified via command line arg. * Fixed issue with `appid` not being properly used when specified via command line arg.
* Fixed issue with running Getdown on single CPU systems (or virtual systems). It was attempting to * Fixed issue with running Getdown on single CPU systems (or virtual systems). It was attempting to
@@ -53,7 +53,7 @@ public final class EnvConfig {
String appDir = null, appDirProv = null; String appDir = null, appDirProv = null;
String appId = null, appIdProv = null; String appId = null, appIdProv = null;
String appBase = null, appBaseProv = null; String appBase = null, appBaseProv = null;
String[] sysargs;
// start with bootstrap.properties config, if avaialble // start with bootstrap.properties config, if avaialble
try { try {
ResourceBundle bundle = ResourceBundle.getBundle("bootstrap"); ResourceBundle bundle = ResourceBundle.getBundle("bootstrap");
@@ -70,19 +70,14 @@ public final class EnvConfig {
appBase = bundle.getString("appbase"); appBase = bundle.getString("appbase");
appBaseProv = "bootstrap.properties"; appBaseProv = "bootstrap.properties";
} }
// if any system properties are specified (keys prefixed with sys.), set those up
// Set system properties. Should be in the form: for (String key : bundle.keySet()) {
// sysargs = [key1]:[val1] , [key2]:[val2], [key3] if (key.startsWith("sys.")) {
if (bundle.containsKey("sysargs")) { String skey = key.substring(4);
sysargs = bundle.getString("sysargs").split(","); String svalue = bundle.getString(key);
notes.add(Note.info("Setting system property from bundle: " +
for (String sysarg : sysargs) { skey + "='" + svalue + "'"));
String[] arg_value = sysarg.trim().split(":", 2); System.setProperty(skey, svalue);
if(arg_value.length == 2){
System.setProperty(arg_value[0], arg_value[1]);
}else if(arg_value.length == 1) {
System.setProperty(arg_value[0], "");
}
} }
} }