Seperating usecase test suite dependencies
[integration/csit.git] / plans / usecases-pnf-sw-upgrade / pnf-sw-upgrade / sorch / simulator / package / docker / src / main / docker / docker-files / scripts / start-app.sh
1 #!/bin/sh
2
3 # ============LICENSE_START=======================================================
4 #   Copyright (C) 2019 Nordix Foundation.
5 # ================================================================================
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #
18 #  SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20
21 # @author Waqas Ikram (waqas.ikram@est.tech)
22
23 touch /app/app.jar
24
25 if [ "$(ls -1 /app/ca-certificates)" ]; then
26  needUpdate=FALSE
27  for certificate in `ls -1 /app/ca-certificates`; do
28     echo "Installing $certificate in /usr/local/share/ca-certificates"
29     cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate
30     needUpdate=TRUE
31  done
32  if [ $needUpdate = TRUE ]; then
33     echo "Updating ca-certificates . . ."
34     update-ca-certificates --fresh
35  fi
36 fi 
37
38 if [ -z "$APP" ]; then
39     echo "CONFIG ERROR: APP environment variable not set"
40     exit 1
41 fi
42
43 echo "Starting $APP simulator ... "
44
45 if [ -z "${CONFIG_PATH}" ]; then
46     export CONFIG_PATH=/app/config/override.yaml
47 fi
48
49 if [ -z "${LOG_PATH}" ]; then
50     export LOG_PATH="logs/${APP}"
51 fi
52
53 if [ "${SSL_DEBUG}" = "log" ]; then
54     export SSL_DEBUG="-Djavax.net.debug=all"
55 else
56     export SSL_DEBUG=
57 fi
58
59
60 jvmargs="${JVM_ARGS} -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}"
61
62 echo "JVM Arguments: ${jvmargs}"
63
64 java ${jvmargs} -jar app.jar
65 rc=$?
66
67 echo "Application exiting with status code $rc"
68
69 exit $rc