blob: 26e6950345640948122f5d7d328b52d1518bed17 [file] [log] [blame]
Jim Hahn84eb1882021-04-06 15:39:14 -04001#!/usr/bin/env sh
ramvermad1a702c2019-02-11 15:20:09 +00002#
3# ============LICENSE_START=======================================================
a.sreekumar46c781f2020-01-08 13:03:27 +00004# Copyright (C) 2019-2020 Nordix Foundation.
Jim Hahn84eb1882021-04-06 15:39:14 -04005# Modifications Copyright (C) 2019-2021 AT&T Intellectual Property.
ramvermad1a702c2019-02-11 15:20:09 +00006# ================================================================================
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
Jim Hahn78d7bb22020-01-15 16:45:49 -050023JAVA_HOME=/usr/lib/jvm/java-11-openjdk/
jhhe32cb022020-08-03 15:18:59 -050024KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}"
25TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}"
26KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}"
27TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}"
ramvermad1a702c2019-02-11 15:20:09 +000028
Jim Hahn4a3cfdf2019-03-12 11:53:22 -040029if [ "$#" -ge 1 ]; then
ramvermad1a702c2019-02-11 15:20:09 +000030 CONFIG_FILE=$1
31else
32 CONFIG_FILE=${CONFIG_FILE}
33fi
34
Taka Cho14a8a2f2020-11-30 13:50:21 -050035if [ -z "$CONFIG_FILE" ]; then
shaoqiud8484162019-06-28 05:02:39 +000036 CONFIG_FILE="${POLICY_HOME}/etc/defaultConfig.json"
ramvermad1a702c2019-02-11 15:20:09 +000037fi
38
Jim Hahn4a3cfdf2019-03-12 11:53:22 -040039echo "Policy pap config file: $CONFIG_FILE"
Jim Hahn4a3cfdf2019-03-12 11:53:22 -040040
Taka Cho14a8a2f2020-11-30 13:50:21 -050041if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then
jhh2053c232019-10-16 19:39:55 -050042 echo "overriding policy-truststore"
jhhe32cb022020-08-03 15:18:59 -050043 cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}"
jhh2053c232019-10-16 19:39:55 -050044fi
45
Taka Cho14a8a2f2020-11-30 13:50:21 -050046if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then
jhh2053c232019-10-16 19:39:55 -050047 echo "overriding policy-keystore"
jhhe32cb022020-08-03 15:18:59 -050048 cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}"
jhh2053c232019-10-16 19:39:55 -050049fi
50
Taka Cho14a8a2f2020-11-30 13:50:21 -050051if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then
a.sreekumar46c781f2020-01-08 13:03:27 +000052 echo "overriding logback.xml"
53 cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/
54fi
55
jhh9e627222021-05-27 14:41:11 -050056# provide and external PDP group configuration if a groups.json
57# file is present in the data directory. If none is present,
58# the PAP will use the PapDb.json resource in the classpath
59# to load a default group.
60
61if [ -f "${POLICY_HOME}/etc/mounted/groups.json" ]; then
62 CUSTOM_GROUPS="-g ${POLICY_HOME}/etc/mounted/groups.json"
63fi
64
65$JAVA_HOME/bin/java -cp "${POLICY_HOME}/etc:${POLICY_HOME}/lib/*" \
66 -Dlogback.configurationFile="${POLICY_HOME}/etc/logback.xml" \
67 -Djavax.net.ssl.keyStore="${KEYSTORE}" \
68 -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PASSWD}" \
69 -Djavax.net.ssl.trustStore="${TRUSTSTORE}" \
70 -Djavax.net.ssl.trustStorePassword="${TRUSTSTORE_PASSWD}" \
71 org.onap.policy.pap.main.startstop.Main \
jhh7ef737a2021-06-02 12:27:51 -050072 -c "${CONFIG_FILE}" ${CUSTOM_GROUPS}