Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions infrastructure/scripts/create-testdata/create-environments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ set -o pipefail
FRONTEND_PORT=8081 # see docker-compose.yml
cd "$(dirname "$0")"
testData=${1:-"./testdata_template/environments"}
useOldApi=false

for filename in "$testData"/*; do
configFile="$filename"/config.json
env=$(basename -- "$filename")
env=$(echo "$env" | awk '{print tolower($0)}')
echo Writing "$env"...
DATA=$(cat "$configFile")
curl -f -X POST -H "multipart/form-data" \
--form-string "config=${DATA}" \
http://localhost:${FRONTEND_PORT}/environments/"${env}"
echo "useOldApi=$useOldApi"
if $useOldApi; then
curl -f -X POST -H "multipart/form-data" \
--form-string "config=${DATA}" \
http://localhost:${FRONTEND_PORT}/environments/"${env}"
else
curl -X POST -H "multipart/form-data" \
--form-string "config=${DATA}" \
http://localhost:${FRONTEND_PORT}/api/environments/"${env}"
fi
done

echo # curl sometimes does not print a trailing \n
Loading