set server truststore params as optional 90/75490/1
authorBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Tue, 8 Jan 2019 18:39:32 +0000 (13:39 -0500)
committerBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Tue, 8 Jan 2019 18:41:36 +0000 (13:41 -0500)
set server truststore params as optional

Change-Id: I5f2eba676fa73c59442bf8a809a93328eb0e2051
Issue-ID: AAI-2046
Signed-off-by: Bansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
src/main/bin/start.sh
src/main/java/org/onap/aai/datarouter/Application.java

index bb219b8..76b5991 100644 (file)
@@ -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}
 
index 42b459d..1a2a5e7 100644 (file)
@@ -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);
     }