/** * Get an environment string or a default value. * * @param variableName Environment variable variableName * @param defaultValue Default value to return */ public static String getEnvironmentStringOrDefault(String variableName, String defaultValue) { // Validate parameters if (variableName == null || variableName.isEmpty()) throw new RuntimeException( "Cannot get environment string - The variableName input was null."); LoggingHelper.LogVerbose(CLASS_NAME, "Loading enviroment variable: %s", variableName); // Get the environment variable String environ = System.getenv(variableName); if (variableName == null || variableName.isEmpty()) { LoggingHelper.LogInfo( CLASS_NAME, "The variable '%s' is not set. Defaulting to: %s", variableName, defaultValue); return defaultValue; } return environ; }