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

APP="$1"

if [[ "$(is_app_vhost_enabled $APP)" == "false" ]]; then
  echo true # bind to external ip. VHOST is disabled
elif [[ "$(is_global_vhost_enabled $APP)" == "false" ]] && [[ ! -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
  echo true # bind to external ip. no global vhost or global vhost is an ip
else
  echo false
fi
