Updated pom to remove distribution-management section and corrected aai base image...
[aai/babel.git] / src / main / bin / start.sh
1 #!/bin/sh
2
3 # ============LICENSE_START=======================================================
4 # org.onap.aai
5 # ================================================================================
6 # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
7 # Copyright (c) 2017-2019 European Software Marketing Ltd.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #      http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END=========================================================
21
22 APP_HOME="${APP_HOME:-/opt/app/babel}"
23 mkdir -p ${APP_HOME}/logs/gc
24
25 if [ -z "${CONFIG_HOME}" ]; then
26         echo "CONFIG_HOME must be set in order to start the process"
27         exit 1
28 fi
29
30 #Either keystore password or server certs location must be passed. Both cannot be null
31 if [ -z "${KEY_STORE_PASSWORD}" -a -z "${SERVER_CERTS_LOCATION}" ]; then
32         echo "KEY_STORE_PASSWORD or SERVER_CERTS_LOCATION must be set in order to start the process"
33         exit 1
34 fi
35
36 PROPS="-DAPP_HOME=${APP_HOME}"
37 PROPS="${PROPS} -DCONFIG_HOME=${CONFIG_HOME}"
38 PROPS="${PROPS} -Dtosca.mappings.config=${CONFIG_HOME}/tosca-mappings.json"
39
40 if [ ! -z "$KEY_STORE_PASSWORD" ]; then
41    PROPS="${PROPS} -DKEY_STORE_PASSWORD=${KEY_STORE_PASSWORD}"
42 fi
43
44 PROPS="${PROPS} -Dlogging.config=${APP_HOME}/config/logback.xml"
45
46 if [ ! -z "$REQUIRE_CLIENT_AUTH" ]; then
47    PROPS="$PROPS -Dserver.ssl.client-auth=${REQUIRE_CLIENT_AUTH}"
48 fi
49 if [ ! -z "$SERVER_CERTS_LOCATION" ]; then
50    PROPS="$PROPS -Dserver.certs.location=${SERVER_CERTS_LOCATION}"
51    PROPS="$PROPS -Dserver.ssl.key-store=${SERVER_CERTS_LOCATION}/${SERVER_KEY_STORE}"
52    PROPS="$PROPS -Dserver.ssl.trust-store=${SERVER_CERTS_LOCATION}/${SERVER_TRUST_STORE}"
53 fi
54 PROPS="${PROPS} -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE}"
55 PROPS="${PROPS} -Daaf.cadi.file=${CONFIG_HOME}/cadi.properties"
56
57 exec java ${JVM_OPTS} ${PROPS} -jar ${APP_HOME}/babel*.jar
58