Files
dokku/plugins/nginx-vhosts/pre-disable-vhost
Jose Diaz-Gonzalez 915172c0c5 fix: move proxy-port properties to proxy plugin and fix CI failures
- Move proxy-port and proxy-ssl-port properties from ports plugin to
  proxy plugin where they conceptually belong
- Generalize proxy:set to handle any property (matching ps:set pattern)
  instead of only handling the type property
- Fix apps:set --global flag parsing (pflag treats --global as a flag,
  not an argument — must be defined explicitly like ps:set does)
- Add missing property-functions source to scheduler-docker-local
  shell scripts (scheduler-enter, scheduler-run, scheduler-deploy,
  check-deploy, bin/scheduler-deploy-process-container)
- Update nginx-vhosts property references from ports to proxy plugin
- Update tests to use proxy:set for proxy-port properties
2026-04-25 17:19:42 -04:00

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
trigger-nginx-vhosts-pre-disable-vhost() {
declare desc="unset port prior to vhosts being disabled"
declare trigger="pre-disable-vhost"
declare APP="$1"
if [[ "$(plugn trigger proxy-type "$APP")" != "nginx" ]]; then
return
fi
# only clear ports if they are port 80 or 443
local PROXY_PORT=$(plugn trigger ports-get-property "$APP" "proxy-port")
local PROXY_SSL_PORT=$(plugn trigger ports-get-property "$APP" "proxy-ssl-port")
if [[ "$PROXY_PORT" == "80" ]]; then
fn-plugin-property-delete "proxy" "$APP" "proxy-port"
fi
if [[ "$PROXY_SSL_PORT" == "443" ]]; then
fn-plugin-property-delete "proxy" "$APP" "proxy-ssl-port"
fi
# clear ports if there is a mapping starting with http:80 or https:443
local PORT_MAPS=$(plugn trigger ports-get "$APP")
for PORT_MAP in $PORT_MAPS; do
if [[ "$PORT_MAP" == "http:80:"* ]] || [[ "$PORT_MAP" == "https:443:"* ]]; then
plugn trigger ports-clear "$APP"
break
fi
done
}
trigger-nginx-vhosts-pre-disable-vhost "$@"