This repository has been archived by the owner on Feb 7, 2025. It is now read-only.
generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to automate RS org settings updates for local testing (#1489)
* Added script to automate updating RS org settings for local testing * Replaced step in RS setup with script * Extracted relative path into variable * Added documentation for script * Added check for yq tool in the script
1 parent
f1058b3
commit 2b1b01d
Showing
2 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
source "$CDCTI_HOME/scripts/hurl/utils.sh" | ||
|
||
# This script updates the organization settings YAML files in RS to: | ||
# - use local REST transport settings for Flexion's etor-service-receiver receivers | ||
# - use local SFTP transport settings for Flexion's simulated-hospital and simulated-lab receivers | ||
# - use local SFTP transport settings for partner organizations | ||
|
||
# Requirements: | ||
# - yq (https://github.com/mikefarah/yq) | ||
# - This script should run inside the prime-router directory of the prime-reportstream codebase | ||
|
||
ORG_SETTINGS_DIR="settings/STLTs" | ||
|
||
check_installed_commands yq | ||
|
||
echo "Updating transport in Flexion org settings file..." | ||
yq eval '.[0].receivers[] |= ( | ||
select(.name == "simulated-hospital" or .name == "simulated-lab").transport = { | ||
"type": "SFTP", | ||
"host": "sftp", | ||
"port": 22, | ||
"filePath": "./upload", | ||
"credentialName": "DEFAULT-SFTP" | ||
} | | ||
select(.name == "etor-service-receiver-orders") |= ( | ||
.transport.authTokenUrl = "http://host.docker.internal:8080/v1/auth/token" | | ||
.transport.reportUrl = "http://host.docker.internal:8080/v1/etor/orders" | ||
) | | ||
select(.name == "etor-service-receiver-results") |= ( | ||
.transport.authTokenUrl = "http://host.docker.internal:8080/v1/auth/token" | | ||
.transport.reportUrl = "http://host.docker.internal:8080/v1/etor/results" | ||
) | ||
)' -i "$ORG_SETTINGS_DIR/Flexion/flexion.yml" | ||
|
||
echo "Updating transport in partner org settings files..." | ||
for file in "$ORG_SETTINGS_DIR/CA/ucsd.yml" "$ORG_SETTINGS_DIR/LA/la-ochsner.yml" "$ORG_SETTINGS_DIR/LA/la-phl.yml"; do | ||
yq eval '.[0].receivers[] |= select(.name == "etor-nbs-results" or .name == "etor-nbs-orders").transport = { | ||
"type": "SFTP", | ||
"host": "sftp", | ||
"port": 22, | ||
"filePath": "./upload", | ||
"credentialName": "DEFAULT-SFTP" | ||
}' -i "$file" | ||
done | ||
|
||
echo "Updates completed." |