Skip to content

Commit

Permalink
Update setup script to remove code duplication and update variables only
Browse files Browse the repository at this point in the history
  • Loading branch information
saquino0827 committed Dec 11, 2024
1 parent f1359d5 commit 98511de
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions scripts/setup/setup-reportstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 98511de

Please sign in to comment.