Fixed project version parsing
[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 # jre-alpine image has $JAVA_HOME set and added to $PATH
23 # ubuntu image requires to set $JAVA_HOME and add java to $PATH manually
24 if ( uname -v | grep -i "ubuntu" ); then
25     export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-`dpkg --print-architecture | awk -F- '{ print $NF }'`
26     export PATH=${JAVA_HOME}:$PATH
27 fi
28
29 APP_HOME="${APP_HOME:-/opt/app/babel}"
30
31 if [ -z "${CONFIG_HOME}" ]; then
32         echo "CONFIG_HOME must be set in order to start the process"
33         exit 1
34 fi
35
36 if [ -z "${KEY_STORE_PASSWORD}" ]; then
37         echo "KEY_STORE_PASSWORD must be set in order to start the process"
38         exit 1
39 fi
40
41 PROPS="-DAPP_HOME=${APP_HOME}"
42 PROPS="${PROPS} -DCONFIG_HOME=${CONFIG_HOME}"
43 PROPS="${PROPS} -Dtosca.mappings.config=${CONFIG_HOME}/tosca-mappings.json"
44 PROPS="${PROPS} -DKEY_STORE_PASSWORD=${KEY_STORE_PASSWORD}"
45 if [ ! -z "$REQUIRE_CLIENT_AUTH" ]; then
46    PROPS="$PROPS -Dserver.ssl.client-auth=${REQUIRE_CLIENT_AUTH}"
47 fi
48
49 JVM_MAX_HEAP=${MAX_HEAP:-1024}
50
51 JARFILE=$(ls ./babel*.jar);
52
53 exec java -Xmx${JVM_MAX_HEAP}m ${PROPS} -jar ${APP_HOME}/${JARFILE}