fix: split openresty report keys into global and computed pairs

The `openresty:report --format json` payload emitted bare property names for the four global-only properties (`image`, `letsencrypt-email`, `letsencrypt-server`, `allowed-letsencrypt-domains-func-base64`), while `hsts` already used the `global-`/`computed-` convention adopted by the other proxy plugins. External tooling consuming the report had to maintain a per-property naming map within a single plugin. The global flag map now emits `--openresty-global-<X>` (raw stored value, empty when unset) and `--openresty-computed-<X>` (effective value with the built-in default applied) for those four properties plus `hsts`, and the per-app map gains the same pair for the global-only properties. The compose template and the two non-report callers consume the `computed-` accessors so the runtime behavior is unchanged.
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-25 12:45:53 -04:00
parent 961bbca6d8
commit f9de91fc4b
7 changed files with 206 additions and 32 deletions

View File

@@ -70,34 +70,43 @@ cmd-openresty-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--openresty-allowed-letsencrypt-domains-func-base64: $(fn-openresty-allowed-letsencrypt-domains-func-base64)"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "true")"
"--openresty-image: $(fn-openresty-image)"
"--openresty-letsencrypt-email: $(fn-openresty-letsencrypt-email)"
"--openresty-letsencrypt-server: $(fn-openresty-letsencrypt-server)"
"--openresty-global-allowed-letsencrypt-domains-func-base64: $(fn-openresty-global-allowed-letsencrypt-domains-func-base64)"
"--openresty-computed-allowed-letsencrypt-domains-func-base64: $(fn-openresty-computed-allowed-letsencrypt-domains-func-base64)"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "")"
"--openresty-computed-hsts: $(fn-openresty-hsts-is-enabled "--global")"
"--openresty-global-image: $(fn-openresty-global-image)"
"--openresty-computed-image: $(fn-openresty-computed-image)"
"--openresty-global-letsencrypt-email: $(fn-openresty-global-letsencrypt-email)"
"--openresty-computed-letsencrypt-email: $(fn-openresty-computed-letsencrypt-email)"
"--openresty-global-letsencrypt-server: $(fn-openresty-global-letsencrypt-server)"
"--openresty-computed-letsencrypt-server: $(fn-openresty-computed-letsencrypt-server)"
)
else
verify_app_name "$APP"
flag_map=(
"--openresty-access-log-format: $(fn-openresty-access-log-format "$APP")"
"--openresty-access-log-path: $(fn-openresty-access-log-path "$APP")"
"--openresty-allowed-letsencrypt-domains-func-base64: $(fn-openresty-allowed-letsencrypt-domains-func-base64)"
"--openresty-global-allowed-letsencrypt-domains-func-base64: $(fn-openresty-global-allowed-letsencrypt-domains-func-base64)"
"--openresty-computed-allowed-letsencrypt-domains-func-base64: $(fn-openresty-computed-allowed-letsencrypt-domains-func-base64)"
"--openresty-bind-address-ipv4: $(fn-openresty-bind-address-ipv4 "$APP")"
"--openresty-bind-address-ipv6: $(fn-openresty-bind-address-ipv6 "$APP")"
"--openresty-client-body-timeout: $(fn-openresty-client-body-timeout "$APP")"
"--openresty-client-header-timeout: $(fn-openresty-client-header-timeout "$APP")"
"--openresty-client-max-body-size: $(fn-openresty-client-max-body-size "$APP")"
"--openresty-error-log-path: $(fn-openresty-error-log-path "$APP")"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "true")"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "")"
"--openresty-computed-hsts: $(fn-openresty-hsts-is-enabled "$APP")"
"--openresty-hsts: $(fn-plugin-property-get-default "openresty" "$APP" "hsts" "")"
"--openresty-hsts-include-subdomains: $(fn-openresty-hsts-include-subdomains "$APP")"
"--openresty-hsts-max-age: $(fn-openresty-hsts-max-age "$APP")"
"--openresty-hsts-preload: $(fn-openresty-hsts-preload "$APP")"
"--openresty-image: $(fn-openresty-image)"
"--openresty-global-image: $(fn-openresty-global-image)"
"--openresty-computed-image: $(fn-openresty-computed-image)"
"--openresty-keepalive-timeout: $(fn-openresty-keepalive-timeout "$APP")"
"--openresty-letsencrypt-email: $(fn-openresty-letsencrypt-email)"
"--openresty-letsencrypt-server: $(fn-openresty-letsencrypt-server)"
"--openresty-global-letsencrypt-email: $(fn-openresty-global-letsencrypt-email)"
"--openresty-computed-letsencrypt-email: $(fn-openresty-computed-letsencrypt-email)"
"--openresty-global-letsencrypt-server: $(fn-openresty-global-letsencrypt-server)"
"--openresty-computed-letsencrypt-server: $(fn-openresty-computed-letsencrypt-server)"
"--openresty-lingering-timeout: $(fn-openresty-lingering-timeout "$APP")"
"--openresty-proxy-buffer-size: $(fn-openresty-proxy-buffer-size "$APP")"
"--openresty-proxy-buffering: $(fn-openresty-proxy-buffering "$APP")"