Merge pull request #8508 from dokku/8230-renaming-app-clears-the-set-domain
Preserve all domains when renaming an app
This commit is contained in:
@@ -7,11 +7,20 @@ trigger-domains-post-app-rename-setup() {
|
||||
declare trigger="post-app-rename-setup"
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$OLD_APP/VHOST" ]]; then
|
||||
while read -r VHOST || [[ -n "$VHOST" ]]; do
|
||||
sed -e "s/$OLD_APP.$VHOST/$NEW_APP.$VHOST/g" "$DOKKU_ROOT/$OLD_APP/VHOST" >"$DOKKU_ROOT/$NEW_APP/VHOST"
|
||||
done <"$DOKKU_ROOT/VHOST"
|
||||
if [[ ! -f "$DOKKU_ROOT/$OLD_APP/VHOST" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cp -f "$DOKKU_ROOT/$OLD_APP/VHOST" "$DOKKU_ROOT/$NEW_APP/VHOST"
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
while read -r VHOST || [[ -n "$VHOST" ]]; do
|
||||
[[ -z "$VHOST" ]] && continue
|
||||
sed -i -e "s/${OLD_APP}\.${VHOST}/${NEW_APP}.${VHOST}/g" "$DOKKU_ROOT/$NEW_APP/VHOST"
|
||||
done <"$DOKKU_ROOT/VHOST"
|
||||
}
|
||||
|
||||
trigger-domains-post-app-rename-setup "$@"
|
||||
|
||||
Reference in New Issue
Block a user