public static String getAppUrl() { return EnvUtils.findProperty("app.couch.url", "http://localhost:5984"); } }
public static String findProperty(String propertyName, String defaultValue) { String value = getSystemProperty(propertyName); if (StringUtils.isNotBlank(value)) { return value; } else { return findEnvironmentProperty(System.getenv(), propertyName, defaultValue); } }
public static String requireProperty(String propertyName) { return requireProperty(propertyName, IllegalArgumentException.class); }
public static String findProperty(String propertyName) { return findProperty(propertyName, null); }
public static String getAppUserName() { return EnvUtils.findProperty("app.couch.userName", "app-user"); }
public static String findContextRoot() { return EnvUtils.findProperty("push.server.context.root", ""); }
private String findProperty(Map<String,String> substitutionsMap) { // Check the map first. if (substitutionsMap.containsKey(name)) { return substitutionsMap.get(name); } // If not in the map then check the system properties and then environment. return EnvUtils.findProperty(name); } }
private String findProperty(Map<String,String> substitutionsMap) { // Check the map first. if (substitutionsMap.containsKey(name)) { return substitutionsMap.get(name); } // If not in the map then check the system properties and then environment. return EnvUtils.findProperty(name); } }
private String findProperty(Map<String,String> substitutionsMap) { // Check the map first. if (substitutionsMap.containsKey(name)) { return substitutionsMap.get(name); } // If not in the map then check the system properties and then environment. return EnvUtils.findProperty(name); } }
public String[] resolveSpringProfiles(String additionalProfiles) { String activeProfiles = EnvUtils.findProperty(profilesPropertyName, ""); if (StringUtils.isNotBlank(activeProfiles)) activeProfiles += ","; activeProfiles += additionalProfiles; System.setProperty(profilesPropertyName, activeProfiles); log.info("Active spring profiles: {}", activeProfiles); String[] values = activeProfiles.split(","); for (int i = 0; i < values.length; i++) { values[i] = values[i].trim(); } return values; } }
public static String requireProperty(String propertyName, Class<? extends RuntimeException> type) { String value = findProperty(propertyName, null); if (StringUtils.isNotBlank(value)) { return value; } String msg = String.format("The system or environment property \"%s\" must be specified.", propertyName); try { throw type.getConstructor(String.class).newInstance(msg); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { log.error("Cannot create custom exception: " + type.getName(), ex); // Fall back to our default throw new IllegalArgumentException(msg); } }
public static String getAppPassword() { String userName = getAppUserName(); return EnvUtils.findProperty("app.couch.password", userName); }
public String resolveSpringPath(Path configDir, String fileName, String internalFile) throws FileNotFoundException { ExceptionUtils.assertNotNull(fileName, "fileName"); String springFileName = EnvUtils.findProperty(springPropertyName); String springConfigPath;
String runtimeDirArg = EnvUtils.findProperty(runtimePropertyName);
String logConfigArg = EnvUtils.findProperty(propertyName, fileName); Path logConfigFile = configDir.resolve(logConfigArg);
Collections.addAll(locations, locationString.split(",")); String secretLocation = EnvUtils.findProperty(propertyName, ""); if (StringUtils.isBlank(secretLocation)) { log.warn("Unable to locate the secret properties file - the system or environment property \"{}\" was found but is null.", propertyName);