fix: reject per-app sets for global-only proxy properties

`caddy:set`, `haproxy:set`, and `traefik:set` previously accepted per-app writes for properties that only have a single host-wide reader, so `:set myapp image foo:bar` printed a success message while `:report myapp` kept showing the global default. The per-app form is now rejected with `The key '<key>' can only be set globally`, matching the existing rejection used for haproxy `refresh-conf` and traefik `challenge-mode`. Caddy `tls-internal` remains the only legitimate per-app property in this family.
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-10 22:42:57 -04:00
parent a553f04966
commit 822b7dddcd
6 changed files with 62 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ cmd-caddy-set() {
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval" "tls-internal")
local GLOBAL_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval")
local GLOBAL_ONLY_KEYS=("image" "letsencrypt-email" "letsencrypt-server" "log-level" "polling-interval")
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
@@ -25,6 +26,10 @@ cmd-caddy-set() {
verify_app_name "$APP"
fi
if fn-in-array "$KEY" "${GLOBAL_ONLY_KEYS[@]}" && [[ "$APP" != "--global" ]]; then
dokku_log_fail "The key '$KEY' can only be set globally"
fi
if [[ -n "$VALUE" ]]; then
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}"
fn-plugin-property-write "caddy" "$APP" "$KEY" "$VALUE"

View File

@@ -11,7 +11,7 @@ cmd-haproxy-set() {
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server" "refresh-conf")
local GLOBAL_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server" "refresh-conf")
local GLOBAL_ONLY_KEYS=("refresh-conf")
local GLOBAL_ONLY_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server" "refresh-conf")
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"

View File

@@ -11,7 +11,7 @@ cmd-traefik-set() {
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("api-enabled" "api-entry-point" "api-entry-point-address" "api-vhost" "challenge-mode" "dashboard-enabled" "basic-auth-username" "basic-auth-password" "dns-provider" "image" "letsencrypt-email" "letsencrypt-server" "log-level" "http-entry-point" "https-entry-point")
local GLOBAL_KEYS=("api-enabled" "api-entry-point" "api-entry-point-address" "api-vhost" "challenge-mode" "dashboard-enabled" "basic-auth-username" "basic-auth-password" "dns-provider" "image" "letsencrypt-email" "letsencrypt-server" "log-level" "http-entry-point" "https-entry-point")
local GLOBAL_ONLY_KEYS=("api-entry-point" "api-entry-point-address" "challenge-mode" "dns-provider")
local GLOBAL_ONLY_KEYS=("api-enabled" "api-entry-point" "api-entry-point-address" "api-vhost" "basic-auth-username" "basic-auth-password" "challenge-mode" "dashboard-enabled" "dns-provider" "image" "letsencrypt-email" "letsencrypt-server" "log-level" "http-entry-point" "https-entry-point")
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"