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

trigger-nginx-vhosts-proxy-enable() {
  declare desc="enable nginx proxy"
  declare trigger="proxy-enable"
  declare APP="$1"

  if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then
    plugn trigger domains-enable "$APP" "false"
    plugn trigger app-restart "$APP"
  fi
}

trigger-nginx-vhosts-proxy-enable "$@"
