#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/domains/functions"

trigger-domains-post-app-clone-setup() {
  declare desc="removes domain files when setting up a clone"
  declare trigger="post-app-clone-setup"
  declare OLD_APP="$1" NEW_APP="$2"
  local APP_ROOT="$DOKKU_ROOT/$NEW_APP"

  rm -rf "$APP_ROOT/VHOST"
  DOKKU_QUIET_OUTPUT=1 domains_setup "$NEW_APP"
}

trigger-domains-post-app-clone-setup "$@"
