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

trigger-nginx-vhosts-post-proxy-ports-update() {
  declare desc="calls nginx build_config when domains are updated"
  declare trigger="post-proxy-ports-update"
  declare APP="$1" ACTION="$2"

  if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then
    nginx_build_config "$APP"
  fi
}

trigger-nginx-vhosts-post-proxy-ports-update "$@"
