diff --git a/deployment/templates/trs-filer-configmap-job.yaml b/deployment/templates/trs-filer-configmap-job.yaml index 1b0946a..c4fef61 100644 --- a/deployment/templates/trs-filer-configmap-job.yaml +++ b/deployment/templates/trs-filer-configmap-job.yaml @@ -28,6 +28,8 @@ spec: value: {{ .Values.trs_filer.appName }} - name: HOST_NAME value: {{ .Values.host_name }} + - name: MONGO_HOST + value: mongodb-{{ .Values.trs_filer.appName }} restartPolicy: Never serviceAccountName: {{ .Values.trs_filer.appName }}-configurer status: {} diff --git a/update-config-map.sh b/update-config-map.sh index 7ce3c8a..acd4be5 100755 --- a/update-config-map.sh +++ b/update-config-map.sh @@ -10,12 +10,19 @@ then env exit 1 fi + +if [ -z "$MONGO_HOST" ]; +then + MONGO_HOST='mongodb' +fi + echo "Inputs:" echo " CONFIG MAP NAME: $CONFIG_MAP_NAME" echo " API SERVER: $APISERVER" echo " APP CONFIG PATH: $APP_CONFIG_PATH" echo " WES APP NAME: $APP_NAME" echo " HOST NAME: $HOST_NAME" +echo " MONGO_HOST: $MONGO_HOST" NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) @@ -31,9 +38,11 @@ echo "Current Kubernetes namespace: $NAMESPACE"; echo echo " * Getting current default configuration" APP_CONFIG=$(yq --arg HOST_NAME "$HOST_NAME" \ + --arg MONGO_HOST "$MONGO_HOST" \ '.endpoints.service.url_prefix = "https" | .endpoints.service.external_host = $HOST_NAME | - .endpoints.service.external_port = 443' \ + .endpoints.service.external_port = 443 | + .db.host = $MONGO_HOST' \ "$APP_CONFIG_PATH") || exit 4 echo " * Getting current configMap"