#!/bin/bash branch=$1 url=$2 if [ "$branch" == "" ]; then echo missing branch name exit 1 fi if [ "$url" == "" ]; then echo missing url exit 1 fi if [ "$branch" == "master" ]; then paypal=live fi sed -i 's#\(apiBase:\).*#apiBase:"'$url'/api/",#g' api/hooks/config.js sed -i 's#\(frontendBase:\).*#frontendBase:"'$url'/",#g' api/hooks/config.js sed -i 's#\(pppReturnURL:\).*#pppReturnURL:"'$url'/checkout/overview\?type=paypal",#g' api/hooks/config.js sed -i 's#\(pppCancelURL:\).*#pppCancelURL:"'$url'/checkout/payment\?type=paypal",#g' api/hooks/config.js sed -i 's#\(var paypalMode *=\).*#var paypalMode = "'$paypal'"#g' api/hooks/config.js cat api/hooks/config.js sed -i 's#\(sentryEnvironment.*\)".*"#\1"'$branch'"#g' src/config.ts if [[ "$branch" == "master" || "$branch" == "dev" ]]; then sed -i 's#//\( sentry\\.init.*\)#\1#g' src/config.ts fi cat src/config.ts if [ "$branch" != "master" ]; then sed -i 's#\(namespace:.*\)#\1_'$branch'#g' api/config.yml cat api/config.yml fi