blob: 54ed9ed267b0ef4440a456dc26f9c36c49c975db [file] [log] [blame]
mukesh.paliwal36e6d002021-02-05 12:44:04 +05301#!/bin/sh
2#temprary condition
3if [ `id -u` = 0 ]
4then
5 # Install certificates found in the /app/ca-certificates volume, if any.
6
7 needUpdate=FALSE
8
9 for certificate in `ls -1 /app/ca-certificates`; do
10 echo "Installing $certificate in /usr/local/share/ca-certificates"
11 # cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate
12 needUpdate=FALSE
13 done
14
15 # Re-exec this script as the 'onap' user.
16 this=`readlink -f $0`
17 # exec su so -c "$this"
18fi
19
20touch /app/app.jar
21
22if [ ! -z "$DB_HOST" -a -z "$DB_PORT" ]; then
23 export DB_PORT=3306
24fi
25
26if [ -z "${CONFIG_PATH}" ]; then
27 export CONFIG_PATH=/app/config/override.yaml
28fi
29
30if [ "${SSL_DEBUG}" = "log" ]; then
31 export SSL_DEBUG="-Djavax.net.debug=all"
32else
33 export SSL_DEBUG=
34fi
35
36# Set java keystore and truststore options, if specified in the environment.
37
38jksargs=
39
40if [ ! -z "${KEYSTORE}" ]; then
41 jksargs="$jksargs -Dmso.load.ssl.client.keystore=true"
42 jksargs="$jksargs -Djavax.net.ssl.keyStore=$KEYSTORE"
43 jksargs="$jksargs -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWORD}"
44fi
45
46if [ ! -z "${TRUSTSTORE}" ]; then
47 jksargs="$jksargs -Djavax.net.ssl.trustStore=${TRUSTSTORE}"
48 jksargs="$jksargs -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}"
49fi
50
51if [ -z "${ACTIVE_PROFILE}" ]; then
52 export ACTIVE_PROFILE="basic"
53fi
54
55jvmargs="${JVM_ARGS} -Dspring.profiles.active=${ACTIVE_PROFILE} -Djava.security.egd=file:/dev/./urandom -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}"
56
57
58read_properties(){
59 while IFS="=" read -r key value; do
60 case "${key}" in
61 '#'*) ;;
62 *)
63 eKey=$(echo $key | tr '[:lower:]' '[:upper:]')
64 export "$eKey"="$value"
65 esac
66 done <<-EOF
67 $1
68 EOF
69}
70
71
72
73if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then
74read_properties "$(head -n 4 /app/certs/.passphrases)"
75fi
76
77echo "JVM Arguments: ${jvmargs}"
78
79java ${jvmargs} -jar app.jar
80rc=$?
81
82echo "Application exiting with status code $rc"
83
84if [ ! -z "${EXIT_DELAY}" -a "${EXIT_DELAY}" != 0 ]; then
85 echo "Delaying $APP exit for $EXIT_DELAY seconds"
86 sleep $EXIT_DELAY
87fi
88
89exit $rc