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

@@ -36,6 +36,33 @@ teardown() {
assert_success
}
@test "(caddy) global-only keys" {
for key in image letsencrypt-email letsencrypt-server log-level polling-interval; do
run /bin/bash -c "dokku caddy:set $TEST_APP $key somevalue"
echo "key: $key"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "can only be set globally"
done
run /bin/bash -c "dokku caddy:set $TEST_APP tls-internal true"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku caddy:report $TEST_APP --caddy-tls-internal"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "true"
run /bin/bash -c "dokku caddy:set $TEST_APP tls-internal"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(caddy) caddy:help" {
run /bin/bash -c "dokku caddy"
echo "output: $output"