Access Java System Properties from JavaScript Code

You can access environment-specific variables from Java system properties (the .properties file) by adding the following code snippet to your Java Script code in API Creator:
lac42
You can access environment-specific variables from Java system properties (the 
.properties
 file) by adding the following code snippet to your Java Script code in API Creator:
var readProp = {}; // a common JavaScript technique for name-scoping readProp.readAPIProperties = function readAPIProperties(aPropFileName) { var response = {}; try { prop = java.util.Optional.of(new java.util.Properties()).map(function(p) { p.load(new java.io.FileInputStream(aPropFileName)); return p;}).get(); } catch (e) { print (title + "** readAPIProperties - exception reading properties [" + aPropFileName + "]: " + e); return null; } var propEnum = prop.propertyNames(); while (propEnum.hasMoreElements()) { // you could make these per-API var propName = propEnum.nextElement(); var propValue = prop.getProperty(propName); // + ""; // print(title + "......each prop: " + propName + " = " + propValue); if (propValue.startsWith("{")) response[propName] = JSON.parse(propValue); else response[propName] = propValue; } // print (title + "..readAPIProperties from file [" + propFileName + "] returns -->\n" + JSON.stringify(response)); return response; };
For examples of 
.properties
 files, see the ReadPropertiesFile example on GitHub.
Access your Java system properties from a startup listener.
For more information about startup listeners, see Startup Listeners.