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

trigger-haproxy-vhosts-certs-force() {
  declare desc="haproxy-vhosts certs-force plugin trigger"
  declare trigger="certs-force"
  declare APP="$1"

  if [[ "$(plugn trigger proxy-type "$APP")" != "haproxy" ]]; then
    return
  fi

  if [[ -n "$(fn-haproxy-letsencrypt-email)" ]]; then
    echo true
  fi
}

trigger-haproxy-vhosts-certs-force "$@"
