badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright 2019-present Open Networking Foundation |
| 4 | # |
Ajay Lotan Thakur | b050aa6 | 2022-02-11 13:14:48 -0600 | [diff] [blame] | 5 | # SPDX-License-Identifier: Apache-2.0 |
badhri85 | 4c028b3 | 2021-11-03 18:24:05 -0500 | [diff] [blame] | 6 | |
| 7 | APPLICATION=$1 |
| 8 | set -xe |
| 9 | |
| 10 | mkdir -p /opt/cp/config |
| 11 | cd /opt/cp/config |
| 12 | cp /etc/cp/config/{*.json,*.conf} . |
| 13 | |
| 14 | case $APPLICATION in |
| 15 | "ngic_controlplane") |
| 16 | echo "Starting ngic controlplane app" |
| 17 | cat /opt/cp/config/cp.json |
| 18 | cat /opt/cp/config/subscriber_mapping.json |
| 19 | {{- if .Values.config.coreDump.enabled }} |
| 20 | cp /bin/ngic_controlplane /tmp/coredump/ |
| 21 | {{- end }} |
| 22 | |
| 23 | ngic_controlplane -f /etc/cp/config/ |
| 24 | ;; |
| 25 | |
| 26 | "gx-app") |
| 27 | echo "Starting gx-app" |
| 28 | SPGWC_IDENTITY={{ tuple "spgwc" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }}; |
| 29 | DIAMETER_HOST=$(echo $SPGWC_IDENTITY| cut -d'.' -f1) |
| 30 | DIAMETER_REALM={{ tuple "spgwc" "realm" . | include "omec-control-plane.diameter_endpoint" | quote }}; |
| 31 | chmod +x /bin/make_certs.sh |
| 32 | cp /bin/make_certs.sh /opt/cp/config |
| 33 | /bin/make_certs.sh $DIAMETER_HOST $DIAMETER_REALM |
| 34 | {{- if .Values.config.coreDump.enabled }} |
| 35 | cp /bin/gx_app /tmp/coredump/ |
| 36 | {{- end }} |
| 37 | cd /opt/cp/ |
| 38 | gx_app |
| 39 | ;; |
| 40 | |
| 41 | *) |
| 42 | echo "invalid app $APPLICATION" |
| 43 | ;; |
| 44 | esac |