summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-application/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sparkybe-onap-application/src/main/java')
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyPasswordConfiguration.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyPasswordConfiguration.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyPasswordConfiguration.java
index b554375..3424454 100644
--- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyPasswordConfiguration.java
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyPasswordConfiguration.java
@@ -3,6 +3,7 @@ package org.onap.aai.sparky.config;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.jetty.util.security.Password;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
@@ -12,9 +13,10 @@ import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
public class PropertyPasswordConfiguration
- implements ApplicationContextInitializer<ConfigurableApplicationContext> {
+ implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private static final String JETTY_OBFUSCATION_PATTERN = "OBF:";
+ private static final String ENV = "ENV:";
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
@@ -24,7 +26,7 @@ public class PropertyPasswordConfiguration
decodePasswords(propertySource, propertyOverrides);
if (!propertyOverrides.isEmpty()) {
PropertySource<?> decodedProperties =
- new MapPropertySource("decoded " + propertySource.getName(), propertyOverrides);
+ new MapPropertySource("decoded " + propertySource.getName(), propertyOverrides);
environment.getPropertySources().addBefore(propertySource.getName(), decodedProperties);
}
}
@@ -41,6 +43,9 @@ public class PropertyPasswordConfiguration
if (rawValueString.startsWith(JETTY_OBFUSCATION_PATTERN)) {
String decodedValue = Password.deobfuscate(rawValueString);
propertyOverrides.put(key, decodedValue);
+ } else if(rawValueString.startsWith(ENV)){
+ String decodedValue = System.getProperty(StringUtils.removeStart(rawValueString, ENV));
+ propertyOverrides.put(key, decodedValue);
}
}
}