Jim Hahn | 84eb188 | 2021-04-06 15:39:14 -0400 | [diff] [blame] | 1 | #!/usr/bin/env sh |
ramverma | d1a702c | 2019-02-11 15:20:09 +0000 | [diff] [blame] | 2 | # |
| 3 | # ============LICENSE_START======================================================= |
a.sreekumar | 46c781f | 2020-01-08 13:03:27 +0000 | [diff] [blame] | 4 | # Copyright (C) 2019-2020 Nordix Foundation. |
Jim Hahn | 84eb188 | 2021-04-06 15:39:14 -0400 | [diff] [blame] | 5 | # Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. |
ramverma | d1a702c | 2019-02-11 15:20:09 +0000 | [diff] [blame] | 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 | |
Jim Hahn | 78d7bb2 | 2020-01-15 16:45:49 -0500 | [diff] [blame] | 23 | JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ |
jhh | e32cb02 | 2020-08-03 15:18:59 -0500 | [diff] [blame] | 24 | KEYSTORE="${KEYSTORE:-$POLICY_HOME/etc/ssl/policy-keystore}" |
| 25 | TRUSTSTORE="${TRUSTSTORE:-$POLICY_HOME/etc/ssl/policy-truststore}" |
| 26 | KEYSTORE_PASSWD="${KEYSTORE_PASSWD:-Pol1cy_0nap}" |
| 27 | TRUSTSTORE_PASSWD="${TRUSTSTORE_PASSWD:-Pol1cy_0nap}" |
ramverma | d1a702c | 2019-02-11 15:20:09 +0000 | [diff] [blame] | 28 | |
Jim Hahn | 4a3cfdf | 2019-03-12 11:53:22 -0400 | [diff] [blame] | 29 | if [ "$#" -ge 1 ]; then |
ramverma | d1a702c | 2019-02-11 15:20:09 +0000 | [diff] [blame] | 30 | CONFIG_FILE=$1 |
| 31 | else |
| 32 | CONFIG_FILE=${CONFIG_FILE} |
| 33 | fi |
| 34 | |
Taka Cho | 14a8a2f | 2020-11-30 13:50:21 -0500 | [diff] [blame] | 35 | if [ -z "$CONFIG_FILE" ]; then |
shaoqiu | d848416 | 2019-06-28 05:02:39 +0000 | [diff] [blame] | 36 | CONFIG_FILE="${POLICY_HOME}/etc/defaultConfig.json" |
ramverma | d1a702c | 2019-02-11 15:20:09 +0000 | [diff] [blame] | 37 | fi |
| 38 | |
Jim Hahn | 4a3cfdf | 2019-03-12 11:53:22 -0400 | [diff] [blame] | 39 | echo "Policy pap config file: $CONFIG_FILE" |
Jim Hahn | 4a3cfdf | 2019-03-12 11:53:22 -0400 | [diff] [blame] | 40 | |
Taka Cho | 14a8a2f | 2020-11-30 13:50:21 -0500 | [diff] [blame] | 41 | if [ -f "${POLICY_HOME}/etc/mounted/policy-truststore" ]; then |
jhh | 2053c23 | 2019-10-16 19:39:55 -0500 | [diff] [blame] | 42 | echo "overriding policy-truststore" |
jhh | e32cb02 | 2020-08-03 15:18:59 -0500 | [diff] [blame] | 43 | cp -f "${POLICY_HOME}"/etc/mounted/policy-truststore "${TRUSTSTORE}" |
jhh | 2053c23 | 2019-10-16 19:39:55 -0500 | [diff] [blame] | 44 | fi |
| 45 | |
Taka Cho | 14a8a2f | 2020-11-30 13:50:21 -0500 | [diff] [blame] | 46 | if [ -f "${POLICY_HOME}/etc/mounted/policy-keystore" ]; then |
jhh | 2053c23 | 2019-10-16 19:39:55 -0500 | [diff] [blame] | 47 | echo "overriding policy-keystore" |
jhh | e32cb02 | 2020-08-03 15:18:59 -0500 | [diff] [blame] | 48 | cp -f "${POLICY_HOME}"/etc/mounted/policy-keystore "${KEYSTORE}" |
jhh | 2053c23 | 2019-10-16 19:39:55 -0500 | [diff] [blame] | 49 | fi |
| 50 | |
Taka Cho | 14a8a2f | 2020-11-30 13:50:21 -0500 | [diff] [blame] | 51 | if [ -f "${POLICY_HOME}/etc/mounted/logback.xml" ]; then |
a.sreekumar | 46c781f | 2020-01-08 13:03:27 +0000 | [diff] [blame] | 52 | echo "overriding logback.xml" |
| 53 | cp -f "${POLICY_HOME}"/etc/mounted/logback.xml "${POLICY_HOME}"/etc/ |
| 54 | fi |
| 55 | |
jhh | 9e62722 | 2021-05-27 14:41:11 -0500 | [diff] [blame] | 56 | # 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 | |
| 61 | if [ -f "${POLICY_HOME}/etc/mounted/groups.json" ]; then |
| 62 | CUSTOM_GROUPS="-g ${POLICY_HOME}/etc/mounted/groups.json" |
| 63 | fi |
| 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 \ |
jhh | 7ef737a | 2021-06-02 12:27:51 -0500 | [diff] [blame] | 72 | -c "${CONFIG_FILE}" ${CUSTOM_GROUPS} |