aboutsummaryrefslogtreecommitdiffstats
path: root/models-provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'models-provider/src')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index 73c66d072..3cae650a3 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -103,7 +103,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
daoParameters.setPersistenceUnit(parameters.getPersistenceUnit());
// Decode the password using Base64
- String decodedPassword = new String(Base64.getDecoder().decode(parameters.getDatabasePassword()));
+ String decodedPassword = new String(Base64.getDecoder().decode(getValue(parameters.getDatabasePassword())));
// @formatter:off
Properties jdbcProperties = new Properties();
@@ -127,6 +127,13 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
}
+ private String getValue(final String value) {
+ if (value != null && value.matches("[$][{].*[}]$")) {
+ return System.getenv(value.substring(2, value.length() - 1));
+ }
+ return value;
+ }
+
@Override
public void close() throws PfModelException {
LOGGER.debug("closing the database connection to {} using persistence unit {}", parameters.getDatabaseUrl(),