#!/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"

cmd-nginx-validate() {
  declare desc="validates and optionally cleans up invalid nginx configurations"
  declare cmd="nginx:validate"
  [[ "$1" == "$cmd" ]] && shift 1
  declare APP="$1" FLAG="$2"

  validate_nginx "$APP" "$FLAG"
}

cmd-nginx-validate "$@"
