From 98511de165f1e90822a64172457c7cdf8a931203 Mon Sep 17 00:00:00 2001 From: saquino0827 Date: Wed, 11 Dec 2024 11:37:57 -0600 Subject: [PATCH] Update setup script to remove code duplication and update variables only --- scripts/setup/setup-reportstream.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/setup/setup-reportstream.sh b/scripts/setup/setup-reportstream.sh index 32d404969..e98e5193f 100755 --- a/scripts/setup/setup-reportstream.sh +++ b/scripts/setup/setup-reportstream.sh @@ -16,6 +16,14 @@ echo "Resetting the database and loading the baseline settings..." ./gradlew reloadTable ./gradlew reloadSettings +# Update RS Configuration for the TI API based on docker or gradle +LOCAL_DOCKER_IMAGE_NAME=$(docker ps --filter "name=trusted-intermediary-router-1" | grep trusted-intermediary-router-1) +if [[ ! -z $LOCAL_DOCKER_IMAGE_NAME ]]; then + ti_api_url=${TI_LCL_API_URL} +else + ti_api_url=${TI_DOCKER_LCL_API_URL_RS_CONFIG} +fi + # Need to CD to prime-router to run the prime CLI cd "prime-router" || exit @@ -40,15 +48,9 @@ yq eval '.[0].receivers[] |= ( } )' -i "settings/STLTs/Flexion/flexion.yml" -LOCAL_DOCKER_IMAGE_NAME=$(docker ps --filter "name=trusted-intermediary-router-1" | grep trusted-intermediary-router-1) echo "Updating local URL and host in transport settings..." -if [[ ! -z $LOCAL_DOCKER_IMAGE_NAME ]]; then - sed -i '' "s|__TI_API_URL__|${TI_DOCKER_LCL_API_URL_RS_CONFIG}|g" "settings/STLTs/Flexion/flexion.yml" - sed -i '' "s|__TI_API_HOST__|$(extract_host_from_url "${TI_DOCKER_LCL_API_URL_RS_CONFIG}")|g" "settings/STLTs/Flexion/flexion.yml" -else - sed -i '' "s|__TI_API_URL__|${TI_LCL_API_URL}|g" "settings/STLTs/Flexion/flexion.yml" - sed -i '' "s|__TI_API_HOST__|$(extract_host_from_url "${TI_LCL_API_URL}")|g" "settings/STLTs/Flexion/flexion.yml" -fi +sed -i '' "s|__TI_API_URL__|${ti_api_url}|g" "settings/STLTs/Flexion/flexion.yml" +sed -i '' "s|__TI_API_HOST__|$(extract_host_from_url "${TI_DOCKER_LCL_API_URL_RS_CONFIG}")|g" "settings/STLTs/Flexion/flexion.yml" echo "Updating transport settings in partner org files..." for file in "settings/STLTs/CA/ucsd.yml" "settings/STLTs/LA/la-ochsner.yml" "settings/STLTs/LA/la-phl.yml"; do