X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2FBabelApplication.java;h=9eaa0cecd5bd85beb2a9cea777836c2bcb8cf3a6;hb=be689ed12e6f35dd98606cb5561433c1275d44a8;hp=0b0285b6f18ff47c9051b41ce16874d81c1c4b69;hpb=132d44fe0ab811cde1a1f2ce0f594f1d8ffdacbf;p=aai%2Fbabel.git diff --git a/src/main/java/org/onap/aai/babel/BabelApplication.java b/src/main/java/org/onap/aai/babel/BabelApplication.java index 0b0285b..9eaa0ce 100644 --- a/src/main/java/org/onap/aai/babel/BabelApplication.java +++ b/src/main/java/org/onap/aai/babel/BabelApplication.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,25 +18,29 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel; import java.util.HashMap; import org.eclipse.jetty.util.security.Password; +import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.ImportResource; @SpringBootApplication @ImportResource("classpath:babel-beans.xml") public class BabelApplication extends SpringBootServletInitializer { - private static final String OBFS_PATTERN = "OBF:"; + private static ConfigurableApplicationContext context; /** * Spring Boot Initialization. * - * @param args main args + * @param args + * main args */ public static void main(String[] args) { String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD"); @@ -44,14 +48,19 @@ public class BabelApplication extends SpringBootServletInitializer { throw new IllegalArgumentException("Env property KEY_STORE_PASSWORD not set"); } HashMap props = new HashMap<>(); - String decryptedValue = keyStorePassword.startsWith(OBFS_PATTERN)? Password.deobfuscate(keyStorePassword) : keyStorePassword; + String decryptedValue = keyStorePassword.startsWith(Password.__OBFUSCATE) ? // + Password.deobfuscate(keyStorePassword) : keyStorePassword; props.put("server.ssl.key-store-password", decryptedValue); String requireClientAuth = System.getenv("REQUIRE_CLIENT_AUTH"); props.put("server.ssl.client-auth", Boolean.FALSE.toString().equalsIgnoreCase(requireClientAuth) ? "want" : "need"); - new BabelApplication().configure(new SpringApplicationBuilder(BabelApplication.class).properties(props)) - .run(args); + context = new BabelApplication() + .configure(new SpringApplicationBuilder(BabelApplication.class).properties(props)).run(args); + } + + public static void exit() { + SpringApplication.exit(context); } }