github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/infrastructure/scripts/create-testdata/create-environments.sh (about) 1 #!/bin/bash 2 set -eu 3 set -o pipefail 4 # usage 5 # ./create-environments.sh [path/to/envs] 6 # Note that this just creates files, it doesn't push in git 7 8 FRONTEND_PORT=8081 # see docker-compose.yml 9 cd $(dirname $0) 10 testData=${1:-"./testdata_template/environments"} 11 12 for filename in "$testData"/*; do 13 configFile="$filename"/config.json 14 env=$(basename -- "$filename") 15 echo Writing $env... 16 DATA=$(cat $configFile) 17 curl -f -X POST -H "multipart/form-data" \ 18 --form-string "config=${DATA}" \ 19 http://localhost:${FRONTEND_PORT}/environments/${env} 20 done 21 22 echo # curl sometimes does not print a trailing \n