b3e183a46dc5ed4c2190052c3ff6d111287158c0
[policy/api.git] / testsuites / stability / src / main / resources / apisetup / config / api / bin / policy-api.sh
1 #!/bin/bash
2 #
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
5 #  Modifications Copyright (C) 2020 Nordix Foundation.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
21 #
22
23 JAVA_HOME=/usr/lib/jvm/java-11-openjdk/
24 POLICY_API_HOME=/opt/app/policy/api
25 KEYSTORE="${POLICY_HOME}/etc/ssl/policy-keystore"
26 TRUSTSTORE="${POLICY_HOME}/etc/ssl/policy-truststore"
27
28 if [ "$#" -ge 1 ]; then
29     CONFIG_FILE=$1
30 else
31     CONFIG_FILE=${CONFIG_FILE}
32 fi
33
34 if [ -z "$CONFIG_FILE" ]; then
35     CONFIG_FILE="$POLICY_API_HOME/etc/defaultConfig.json"
36 fi
37
38 echo "Policy api config file: $CONFIG_FILE"
39
40 $JAVA_HOME/bin/java -cp "$POLICY_API_HOME/etc:$POLICY_API_HOME/lib/*" -Dlogback.configurationFile=$POLICY_API_HOME/etc/logback.xml -Djavax.net.ssl.keyStore="$KEYSTORE" -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD:-Pol1cy_0nap}" -Djavax.net.ssl.trustStore="$TRUSTSTORE" -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=$API_HOST org.onap.policy.api.main.startstop.Main -c $CONFIG_FILE