Merge "Updated champ-lib to use the correct logger"
[aai/champ.git] / champ-service / src / main / java / org / onap / champ / ChampApplication.java
index 4477006..bb0a448 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START==========================================
  * org.onap.aai
  * ===================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
+ * Copyright Â© 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright Â© 2017-2018 Amdocs
  * ===================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,8 +22,11 @@ package org.onap.champ;
 
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.annotation.PostConstruct;
+
 import org.eclipse.jetty.util.security.Password;
+import org.onap.champ.service.logging.LoggingUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -39,6 +42,8 @@ public class ChampApplication extends SpringBootServletInitializer {
     private Environment env;
 
     public static void main(String[] args) {
+        LoggingUtil.initMdcContext();
+        
         String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD");
         if (keyStorePassword == null || keyStorePassword.isEmpty()) {
             throw new RuntimeException("Environment property KEY_STORE_PASSWORD not set");
@@ -56,6 +61,13 @@ public class ChampApplication extends SpringBootServletInitializer {
             props.put("server.ssl.trust-store-password", trustStorePassword);
         }
 
+        String requireClientAuth = System.getenv("REQUIRE_CLIENT_AUTH");
+        if (requireClientAuth == null || requireClientAuth.isEmpty()) {
+            props.put("server.ssl.client-auth", "need");
+        }else {
+            props.put("server.ssl.client-auth",requireClientAuth.equals("true")?"need":"want");
+        }       
+
         new ChampApplication().configure(new SpringApplicationBuilder(ChampApplication.class).properties(props))
                 .run(args);
     }