Merge "Allow storing database password in environment variables"
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 08c01b6..50c7390 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
@@ -101,7 +101,7 @@
         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();
@@ -125,6 +125,13 @@
         }
     }
 
+    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(),