tibi-svelte-starter/scripts/modify-config.sh

38 lines
1.0 KiB
Bash
Raw Normal View History

2021-03-22 15:59:05 +01:00
#!/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
2021-09-14 14:45:47 +02:00
if [[ "$branch" == "master" || "$branch" == "dev" ]]; then
2021-03-22 15:59:05 +01:00
sed -i 's#//\( sentry\\.init.*\)#\1#g' src/config.ts
fi
cat src/config.ts
2021-09-14 14:45:47 +02:00
if [ "$branch" != "master" ]; then
sed -i 's#\(namespace:.*\)#\1_'$branch'#g' api/config.yml
cat api/config.yml
fi