summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>2019-01-08 13:39:32 -0500
committerBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>2019-01-08 13:41:36 -0500
commita11b8dda11186bf9c760fce77d080a4390702566 (patch)
treebecae66bba77fdc5912f40338794a39e8982e278
parentab1a2ed3d961919008bad949e62fcf3ba722c2ce (diff)
set server truststore params as optional
set server truststore params as optional Change-Id: I5f2eba676fa73c59442bf8a809a93328eb0e2051 Issue-ID: AAI-2046 Signed-off-by: Bansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
-rw-r--r--src/main/bin/start.sh8
-rw-r--r--src/main/java/org/onap/aai/datarouter/Application.java14
2 files changed, 21 insertions, 1 deletions
diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh
index bb219b8..76b5991 100644
--- a/src/main/bin/start.sh
+++ b/src/main/bin/start.sh
@@ -19,6 +19,14 @@ PROPS="$PROPS -Dlogging.config=$BASEDIR/bundleconfig/etc/logback.xml"
PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME"
PROPS="$PROPS -DKEY_STORE_PASSWORD=$KEY_STORE_PASSWORD"
+if [ ! -z "$TRUST_STORE_PASSWORD" ]; then
+ PROPS="$PROPS -DTRUST_STORE_PASSWORD=${TRUST_STORE_PASSWORD}"
+fi
+
+if [ ! -z "$TRUST_STORE_LOCATION" ]; then
+ PROPS="$PROPS -DTRUST_STORE_LOCATION=${TRUST_STORE_LOCATION}"
+fi
+
JVM_MAX_HEAP=${MAX_HEAP:-1024}
diff --git a/src/main/java/org/onap/aai/datarouter/Application.java b/src/main/java/org/onap/aai/datarouter/Application.java
index 42b459d..1a2a5e7 100644
--- a/src/main/java/org/onap/aai/datarouter/Application.java
+++ b/src/main/java/org/onap/aai/datarouter/Application.java
@@ -56,8 +56,20 @@ public class Application extends SpringBootServletInitializer{
if(keyStorePassword==null || keyStorePassword.isEmpty()){
throw new RuntimeException("Env property KEY_STORE_PASSWORD not set");
}
+
HashMap<String, Object> props = new HashMap<>();
- props.put("server.ssl.key-store-password", Password.deobfuscate(keyStorePassword));
+ String deobfuscatedKeyStorePassword = keyStorePassword.startsWith(JETTY_OBFUSCATION_PATTERN)?Password.deobfuscate(keyStorePassword):keyStorePassword;
+ props.put("server.ssl.key-store-password", deobfuscatedKeyStorePassword);
+
+ String trustStoreLocation = System.getenv("TRUST_STORE_LOCATION");
+ String trustStorePassword = System.getenv("TRUST_STORE_PASSWORD");
+ if(trustStoreLocation!=null && trustStorePassword !=null){
+ trustStorePassword = trustStorePassword.startsWith(JETTY_OBFUSCATION_PATTERN)?Password.deobfuscate(trustStorePassword):trustStorePassword;
+ props.put("server.ssl.trust-store", trustStoreLocation);
+ props.put("server.ssl.trust-store-password", trustStorePassword);
+ }
+
+
new Application().configure(new SpringApplicationBuilder(Application.class).properties(props)).run(args);
}