Adding Infrastructure for Simulate Request for SDC
[integration/csit.git] / plans / so / integration-etsi-testing / so-simulators / 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 [ -z "$APP" ]; then
26     echo "CONFIG ERROR: APP environment variable not set"
27     exit 1
28 fi
29
30 echo "Starting $APP simulator ... "
31
32 if [ -z "${CONFIG_PATH}" ]; then
33     export CONFIG_PATH=/app/config/override.yaml
34 fi
35
36 if [ -z "${LOG_PATH}" ]; then
37     export LOG_PATH="logs/${APP}"
38 fi
39
40 if [ "${SSL_DEBUG}" = "log" ]; then
41     export SSL_DEBUG="-Djavax.net.debug=all"
42 else
43     export SSL_DEBUG=
44 fi
45
46
47 jvmargs="${JVM_ARGS} -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}"
48
49 echo "JVM Arguments: ${jvmargs}"
50
51 java ${jvmargs} -jar app.jar
52 rc=$?
53
54 echo "Application exiting with status code $rc"
55
56 exit $rc