feat: split openresty report into raw/computed/global

Exposes raw, global, and computed report flags for every openresty per-app property and allows those properties to be set with `--global`, so external tooling can distinguish a property that was never set from one left at its built-in default. The computed value resolves the per-app value first, then the global value, then the default. Also corrects `client-header-timeout` which read the `client-body-timeout` key and sets the computed `client-max-body-size` default to `1m`.
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-28 00:03:47 -04:00
parent ee11fa2c63
commit 64b104a2a3
6 changed files with 870 additions and 109 deletions

View File

@@ -70,61 +70,165 @@ cmd-openresty-report-single() {
local flag_map=()
if [[ "$APP" == "--global" ]]; then
flag_map=(
"--openresty-global-access-log-format: $(fn-openresty-global-access-log-format)"
"--openresty-computed-access-log-format: $(fn-openresty-computed-access-log-format "$APP")"
"--openresty-global-access-log-path: $(fn-openresty-global-access-log-path)"
"--openresty-computed-access-log-path: $(fn-openresty-computed-access-log-path "$APP")"
"--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-bind-address-ipv4: $(fn-openresty-global-bind-address-ipv4)"
"--openresty-computed-bind-address-ipv4: $(fn-openresty-computed-bind-address-ipv4 "$APP")"
"--openresty-global-bind-address-ipv6: $(fn-openresty-global-bind-address-ipv6)"
"--openresty-computed-bind-address-ipv6: $(fn-openresty-computed-bind-address-ipv6 "$APP")"
"--openresty-global-client-body-timeout: $(fn-openresty-global-client-body-timeout)"
"--openresty-computed-client-body-timeout: $(fn-openresty-computed-client-body-timeout "$APP")"
"--openresty-global-client-header-timeout: $(fn-openresty-global-client-header-timeout)"
"--openresty-computed-client-header-timeout: $(fn-openresty-computed-client-header-timeout "$APP")"
"--openresty-global-client-max-body-size: $(fn-openresty-global-client-max-body-size)"
"--openresty-computed-client-max-body-size: $(fn-openresty-computed-client-max-body-size "$APP")"
"--openresty-global-error-log-path: $(fn-openresty-global-error-log-path)"
"--openresty-computed-error-log-path: $(fn-openresty-computed-error-log-path "$APP")"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "")"
"--openresty-computed-hsts: $(fn-openresty-hsts-is-enabled "--global")"
"--openresty-global-hsts-include-subdomains: $(fn-openresty-global-hsts-include-subdomains)"
"--openresty-computed-hsts-include-subdomains: $(fn-openresty-computed-hsts-include-subdomains "$APP")"
"--openresty-global-hsts-max-age: $(fn-openresty-global-hsts-max-age)"
"--openresty-computed-hsts-max-age: $(fn-openresty-computed-hsts-max-age "$APP")"
"--openresty-global-hsts-preload: $(fn-openresty-global-hsts-preload)"
"--openresty-computed-hsts-preload: $(fn-openresty-computed-hsts-preload "$APP")"
"--openresty-global-image: $(fn-openresty-global-image)"
"--openresty-computed-image: $(fn-openresty-computed-image)"
"--openresty-global-keepalive-timeout: $(fn-openresty-global-keepalive-timeout)"
"--openresty-computed-keepalive-timeout: $(fn-openresty-computed-keepalive-timeout "$APP")"
"--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-global-lingering-timeout: $(fn-openresty-global-lingering-timeout)"
"--openresty-computed-lingering-timeout: $(fn-openresty-computed-lingering-timeout "$APP")"
"--openresty-global-log-level: $(fn-openresty-global-log-level)"
"--openresty-computed-log-level: $(fn-openresty-computed-log-level)"
"--openresty-global-proxy-buffer-size: $(fn-openresty-global-proxy-buffer-size)"
"--openresty-computed-proxy-buffer-size: $(fn-openresty-computed-proxy-buffer-size "$APP")"
"--openresty-global-proxy-buffering: $(fn-openresty-global-proxy-buffering)"
"--openresty-computed-proxy-buffering: $(fn-openresty-computed-proxy-buffering "$APP")"
"--openresty-global-proxy-buffers: $(fn-openresty-global-proxy-buffers)"
"--openresty-computed-proxy-buffers: $(fn-openresty-computed-proxy-buffers "$APP")"
"--openresty-global-proxy-busy-buffers-size: $(fn-openresty-global-proxy-busy-buffers-size)"
"--openresty-computed-proxy-busy-buffers-size: $(fn-openresty-computed-proxy-busy-buffers-size "$APP")"
"--openresty-global-proxy-connect-timeout: $(fn-openresty-global-proxy-connect-timeout)"
"--openresty-computed-proxy-connect-timeout: $(fn-openresty-computed-proxy-connect-timeout "$APP")"
"--openresty-global-proxy-read-timeout: $(fn-openresty-global-proxy-read-timeout)"
"--openresty-computed-proxy-read-timeout: $(fn-openresty-computed-proxy-read-timeout "$APP")"
"--openresty-global-proxy-send-timeout: $(fn-openresty-global-proxy-send-timeout)"
"--openresty-computed-proxy-send-timeout: $(fn-openresty-computed-proxy-send-timeout "$APP")"
"--openresty-global-send-timeout: $(fn-openresty-global-send-timeout)"
"--openresty-computed-send-timeout: $(fn-openresty-computed-send-timeout "$APP")"
"--openresty-global-underscore-in-headers: $(fn-openresty-global-underscore-in-headers)"
"--openresty-computed-underscore-in-headers: $(fn-openresty-computed-underscore-in-headers "$APP")"
"--openresty-global-x-forwarded-for-value: $(fn-openresty-global-x-forwarded-for-value)"
"--openresty-computed-x-forwarded-for-value: $(fn-openresty-computed-x-forwarded-for-value "$APP")"
"--openresty-global-x-forwarded-port-value: $(fn-openresty-global-x-forwarded-port-value)"
"--openresty-computed-x-forwarded-port-value: $(fn-openresty-computed-x-forwarded-port-value "$APP")"
"--openresty-global-x-forwarded-proto-value: $(fn-openresty-global-x-forwarded-proto-value)"
"--openresty-computed-x-forwarded-proto-value: $(fn-openresty-computed-x-forwarded-proto-value "$APP")"
"--openresty-global-x-forwarded-ssl: $(fn-openresty-global-x-forwarded-ssl)"
"--openresty-computed-x-forwarded-ssl: $(fn-openresty-computed-x-forwarded-ssl "$APP")"
)
else
verify_app_name "$APP"
flag_map=(
"--openresty-access-log-format: $(fn-openresty-access-log-format "$APP")"
"--openresty-computed-access-log-format: $(fn-openresty-computed-access-log-format "$APP")"
"--openresty-global-access-log-format: $(fn-openresty-global-access-log-format)"
"--openresty-access-log-path: $(fn-openresty-access-log-path "$APP")"
"--openresty-computed-access-log-path: $(fn-openresty-computed-access-log-path "$APP")"
"--openresty-global-access-log-path: $(fn-openresty-global-access-log-path)"
"--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-computed-bind-address-ipv4: $(fn-openresty-computed-bind-address-ipv4 "$APP")"
"--openresty-global-bind-address-ipv4: $(fn-openresty-global-bind-address-ipv4)"
"--openresty-bind-address-ipv6: $(fn-openresty-bind-address-ipv6 "$APP")"
"--openresty-computed-bind-address-ipv6: $(fn-openresty-computed-bind-address-ipv6 "$APP")"
"--openresty-global-bind-address-ipv6: $(fn-openresty-global-bind-address-ipv6)"
"--openresty-client-body-timeout: $(fn-openresty-client-body-timeout "$APP")"
"--openresty-computed-client-body-timeout: $(fn-openresty-computed-client-body-timeout "$APP")"
"--openresty-global-client-body-timeout: $(fn-openresty-global-client-body-timeout)"
"--openresty-client-header-timeout: $(fn-openresty-client-header-timeout "$APP")"
"--openresty-computed-client-header-timeout: $(fn-openresty-computed-client-header-timeout "$APP")"
"--openresty-global-client-header-timeout: $(fn-openresty-global-client-header-timeout)"
"--openresty-client-max-body-size: $(fn-openresty-client-max-body-size "$APP")"
"--openresty-computed-client-max-body-size: $(fn-openresty-computed-client-max-body-size "$APP")"
"--openresty-global-client-max-body-size: $(fn-openresty-global-client-max-body-size)"
"--openresty-error-log-path: $(fn-openresty-error-log-path "$APP")"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "")"
"--openresty-computed-hsts: $(fn-openresty-hsts-is-enabled "$APP")"
"--openresty-computed-error-log-path: $(fn-openresty-computed-error-log-path "$APP")"
"--openresty-global-error-log-path: $(fn-openresty-global-error-log-path)"
"--openresty-hsts: $(fn-plugin-property-get-default "openresty" "$APP" "hsts" "")"
"--openresty-computed-hsts: $(fn-openresty-hsts-is-enabled "$APP")"
"--openresty-global-hsts: $(fn-plugin-property-get-default "openresty" "--global" "hsts" "")"
"--openresty-hsts-include-subdomains: $(fn-openresty-hsts-include-subdomains "$APP")"
"--openresty-computed-hsts-include-subdomains: $(fn-openresty-computed-hsts-include-subdomains "$APP")"
"--openresty-global-hsts-include-subdomains: $(fn-openresty-global-hsts-include-subdomains)"
"--openresty-hsts-max-age: $(fn-openresty-hsts-max-age "$APP")"
"--openresty-computed-hsts-max-age: $(fn-openresty-computed-hsts-max-age "$APP")"
"--openresty-global-hsts-max-age: $(fn-openresty-global-hsts-max-age)"
"--openresty-hsts-preload: $(fn-openresty-hsts-preload "$APP")"
"--openresty-computed-hsts-preload: $(fn-openresty-computed-hsts-preload "$APP")"
"--openresty-global-hsts-preload: $(fn-openresty-global-hsts-preload)"
"--openresty-global-image: $(fn-openresty-global-image)"
"--openresty-computed-image: $(fn-openresty-computed-image)"
"--openresty-keepalive-timeout: $(fn-openresty-keepalive-timeout "$APP")"
"--openresty-computed-keepalive-timeout: $(fn-openresty-computed-keepalive-timeout "$APP")"
"--openresty-global-keepalive-timeout: $(fn-openresty-global-keepalive-timeout)"
"--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-computed-lingering-timeout: $(fn-openresty-computed-lingering-timeout "$APP")"
"--openresty-global-lingering-timeout: $(fn-openresty-global-lingering-timeout)"
"--openresty-global-log-level: $(fn-openresty-global-log-level)"
"--openresty-computed-log-level: $(fn-openresty-computed-log-level)"
"--openresty-lingering-timeout: $(fn-openresty-lingering-timeout "$APP")"
"--openresty-proxy-buffer-size: $(fn-openresty-proxy-buffer-size "$APP")"
"--openresty-computed-proxy-buffer-size: $(fn-openresty-computed-proxy-buffer-size "$APP")"
"--openresty-global-proxy-buffer-size: $(fn-openresty-global-proxy-buffer-size)"
"--openresty-proxy-buffering: $(fn-openresty-proxy-buffering "$APP")"
"--openresty-computed-proxy-buffering: $(fn-openresty-computed-proxy-buffering "$APP")"
"--openresty-global-proxy-buffering: $(fn-openresty-global-proxy-buffering)"
"--openresty-proxy-buffers: $(fn-openresty-proxy-buffers "$APP")"
"--openresty-computed-proxy-buffers: $(fn-openresty-computed-proxy-buffers "$APP")"
"--openresty-global-proxy-buffers: $(fn-openresty-global-proxy-buffers)"
"--openresty-proxy-busy-buffers-size: $(fn-openresty-proxy-busy-buffers-size "$APP")"
"--openresty-computed-proxy-busy-buffers-size: $(fn-openresty-computed-proxy-busy-buffers-size "$APP")"
"--openresty-global-proxy-busy-buffers-size: $(fn-openresty-global-proxy-busy-buffers-size)"
"--openresty-proxy-connect-timeout: $(fn-openresty-proxy-connect-timeout "$APP")"
"--openresty-computed-proxy-connect-timeout: $(fn-openresty-computed-proxy-connect-timeout "$APP")"
"--openresty-global-proxy-connect-timeout: $(fn-openresty-global-proxy-connect-timeout)"
"--openresty-proxy-read-timeout: $(fn-openresty-proxy-read-timeout "$APP")"
"--openresty-computed-proxy-read-timeout: $(fn-openresty-computed-proxy-read-timeout "$APP")"
"--openresty-global-proxy-read-timeout: $(fn-openresty-global-proxy-read-timeout)"
"--openresty-proxy-send-timeout: $(fn-openresty-proxy-send-timeout "$APP")"
"--openresty-computed-proxy-send-timeout: $(fn-openresty-computed-proxy-send-timeout "$APP")"
"--openresty-global-proxy-send-timeout: $(fn-openresty-global-proxy-send-timeout)"
"--openresty-send-timeout: $(fn-openresty-send-timeout "$APP")"
"--openresty-computed-send-timeout: $(fn-openresty-computed-send-timeout "$APP")"
"--openresty-global-send-timeout: $(fn-openresty-global-send-timeout)"
"--openresty-underscore-in-headers: $(fn-openresty-underscore-in-headers "$APP")"
"--openresty-computed-underscore-in-headers: $(fn-openresty-computed-underscore-in-headers "$APP")"
"--openresty-global-underscore-in-headers: $(fn-openresty-global-underscore-in-headers)"
"--openresty-x-forwarded-for-value: $(fn-openresty-x-forwarded-for-value "$APP")"
"--openresty-computed-x-forwarded-for-value: $(fn-openresty-computed-x-forwarded-for-value "$APP")"
"--openresty-global-x-forwarded-for-value: $(fn-openresty-global-x-forwarded-for-value)"
"--openresty-x-forwarded-port-value: $(fn-openresty-x-forwarded-port-value "$APP")"
"--openresty-computed-x-forwarded-port-value: $(fn-openresty-computed-x-forwarded-port-value "$APP")"
"--openresty-global-x-forwarded-port-value: $(fn-openresty-global-x-forwarded-port-value)"
"--openresty-x-forwarded-proto-value: $(fn-openresty-x-forwarded-proto-value "$APP")"
"--openresty-computed-x-forwarded-proto-value: $(fn-openresty-computed-x-forwarded-proto-value "$APP")"
"--openresty-global-x-forwarded-proto-value: $(fn-openresty-global-x-forwarded-proto-value)"
"--openresty-x-forwarded-ssl: $(fn-openresty-x-forwarded-ssl "$APP")"
"--openresty-computed-x-forwarded-ssl: $(fn-openresty-computed-x-forwarded-ssl "$APP")"
"--openresty-global-x-forwarded-ssl: $(fn-openresty-global-x-forwarded-ssl)"
)
fi