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

trigger-haproxy-vhosts-proxy-supports-routes() {
  declare desc="advertises path-based routing support for haproxy (currently false)"
  declare trigger="proxy-supports-routes"
  declare APP="$1"

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

  # The byjg/easy-haproxy sidecar image only supports host-based routing.
  # Path-prefix routing requires either an upstream change to that sidecar
  # or a different config-generation strategy.
  echo "false"
}

trigger-haproxy-vhosts-proxy-supports-routes "$@"
