fix: only rename app domains associated with a global domain

Closes #4965
This commit is contained in:
Jose Diaz-Gonzalez
2022-01-28 22:38:24 -05:00
parent 9bde10cdef
commit 26e7a16fd7
4 changed files with 47 additions and 4 deletions

View File

@@ -7,11 +7,12 @@ trigger-domains-post-app-rename-setup() {
declare trigger="post-app-rename-setup"
declare OLD_APP="$1" NEW_APP="$2"
if [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]]; then
sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS"
fi
rm -f "$DOKKU_ROOT/$NEW_APP/URLS"
if [[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]]; then
sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
while read -r VHOST || [[ -n "$VHOST" ]]; do
sed -i -e "s/$OLD_APP.$VHOST/$NEW_APP.$VHOST/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
done <"$DOKKU_ROOT/VHOST"
fi
}