refactor: consolidate property fetching for nginx plugin into golang codebase

Also update the documentation to include docs for all properties.
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-05 13:25:03 -05:00
parent 6625846ecc
commit d4b445985b
14 changed files with 1448 additions and 492 deletions

View File

@@ -38,31 +38,69 @@ cmd-nginx-report-single() {
verify_app_name "$APP"
local flag_map=(
"--nginx-access-log-format: $(fn-nginx-access-log-format "$APP")"
"--nginx-computed-access-log-format: $(fn-nginx-computed-access-log-format "$APP")"
"--nginx-global-access-log-format: $(fn-nginx-global-access-log-format "$APP")"
"--nginx-access-log-path: $(fn-nginx-access-log-path "$APP")"
"--nginx-computed-access-log-path: $(fn-nginx-computed-access-log-path "$APP")"
"--nginx-global-access-log-path: $(fn-nginx-global-access-log-path "$APP")"
"--nginx-bind-address-ipv4: $(fn-nginx-bind-address-ipv4 "$APP")"
"--nginx-computed-bind-address-ipv4: $(fn-nginx-computed-bind-address-ipv4 "$APP")"
"--nginx-global-bind-address-ipv4: $(fn-nginx-global-bind-address-ipv4 "$APP")"
"--nginx-bind-address-ipv6: $(fn-nginx-bind-address-ipv6 "$APP")"
"--nginx-computed-bind-address-ipv6: $(fn-nginx-computed-bind-address-ipv6 "$APP")"
"--nginx-global-bind-address-ipv6: $(fn-nginx-global-bind-address-ipv6 "$APP")"
"--nginx-client-max-body-size: $(fn-nginx-client-max-body-size "$APP")"
"--nginx-disable-custom-config: $(fn-plugin-property-get-default "nginx" "$APP" "disable-custom-config" "false")"
"--nginx-computed-client-max-body-size: $(fn-nginx-computed-client-max-body-size "$APP")"
"--nginx-global-client-max-body-size: $(fn-nginx-global-client-max-body-size "$APP")"
"--nginx-disable-custom-config: $(fn-nginx-disable-custom-config "$APP")"
"--nginx-computed-disable-custom-config: $(fn-nginx-computed-disable-custom-config "$APP")"
"--nginx-global-disable-custom-config: $(fn-nginx-global-disable-custom-config "$APP")"
"--nginx-error-log-path: $(fn-nginx-error-log-path "$APP")"
"--nginx-global-hsts: $(fn-plugin-property-get-default "nginx" "--global" "hsts" "true")"
"--nginx-computed-hsts: $(fn-nginx-hsts-is-enabled "$APP")"
"--nginx-hsts: $(fn-plugin-property-get-default "nginx" "$APP" "hsts" "")"
"--nginx-computed-error-log-path: $(fn-nginx-computed-error-log-path "$APP")"
"--nginx-global-error-log-path: $(fn-nginx-global-error-log-path "$APP")"
"--nginx-hsts-include-subdomains: $(fn-nginx-hsts-include-subdomains "$APP")"
"--nginx-computed-hsts-include-subdomains: $(fn-nginx-computed-hsts-include-subdomains "$APP")"
"--nginx-global-hsts-include-subdomains: $(fn-nginx-global-hsts-include-subdomains "$APP")"
"--nginx-hsts-max-age: $(fn-nginx-hsts-max-age "$APP")"
"--nginx-computed-hsts-max-age: $(fn-nginx-computed-hsts-max-age "$APP")"
"--nginx-global-hsts-max-age: $(fn-nginx-global-hsts-max-age "$APP")"
"--nginx-hsts-preload: $(fn-nginx-hsts-preload "$APP")"
"--nginx-computed-nginx-conf-sigil-path: $(fn-nginx-computed-nginx-conf-sigil-path "$APP")"
"--nginx-global-nginx-conf-sigil-path: $(fn-nginx-global-nginx-conf-sigil-path)"
"--nginx-nginx-conf-sigil-path: $(fn-nginx-nginx-conf-sigil-path "$APP")"
"--nginx-proxy-buffer-size: $(fn-nginx-proxy-buffer-size "$APP")"
"--nginx-proxy-buffering: $(fn-nginx-proxy-buffering "$APP")"
"--nginx-proxy-buffers: $(fn-nginx-proxy-buffers "$APP")"
"--nginx-proxy-busy-buffers-size: $(fn-nginx-proxy-busy-buffers-size "$APP")"
"--nginx-proxy-read-timeout: $(fn-nginx-proxy-read-timeout "$APP")"
"--nginx-computed-hsts-preload: $(fn-nginx-computed-hsts-preload "$APP")"
"--nginx-global-hsts-preload: $(fn-nginx-global-hsts-preload "$APP")"
"--nginx-hsts: $(fn-nginx-hsts "$APP")"
"--nginx-computed-hsts: $(fn-nginx-computed-hsts "$APP")"
"--nginx-global-hsts: $(fn-nginx-global-hsts "$APP")"
"--nginx-last-visited-at: $(fn-nginx-vhosts-last-visited-at "$APP")"
"--nginx-nginx-conf-sigil-path: $(fn-nginx-nginx-conf-sigil-path "$APP")"
"--nginx-computed-nginx-conf-sigil-path: $(fn-nginx-computed-nginx-conf-sigil-path "$APP")"
"--nginx-global-nginx-conf-sigil-path: $(fn-nginx-global-nginx-conf-sigil-path "$APP")"
"--nginx-proxy-buffer-size: $(fn-nginx-proxy-buffer-size "$APP")"
"--nginx-computed-proxy-buffer-size: $(fn-nginx-computed-proxy-buffer-size "$APP")"
"--nginx-global-proxy-buffer-size: $(fn-nginx-global-proxy-buffer-size "$APP")"
"--nginx-proxy-buffering: $(fn-nginx-proxy-buffering "$APP")"
"--nginx-computed-proxy-buffering: $(fn-nginx-computed-proxy-buffering "$APP")"
"--nginx-global-proxy-buffering: $(fn-nginx-global-proxy-buffering "$APP")"
"--nginx-proxy-buffers: $(fn-nginx-proxy-buffers "$APP")"
"--nginx-computed-proxy-buffers: $(fn-nginx-computed-proxy-buffers "$APP")"
"--nginx-global-proxy-buffers: $(fn-nginx-global-proxy-buffers "$APP")"
"--nginx-proxy-busy-buffers-size: $(fn-nginx-proxy-busy-buffers-size "$APP")"
"--nginx-computed-proxy-busy-buffers-size: $(fn-nginx-computed-proxy-busy-buffers-size "$APP")"
"--nginx-global-proxy-busy-buffers-size: $(fn-nginx-global-proxy-busy-buffers-size "$APP")"
"--nginx-proxy-read-timeout: $(fn-nginx-proxy-read-timeout "$APP")"
"--nginx-computed-proxy-read-timeout: $(fn-nginx-computed-proxy-read-timeout "$APP")"
"--nginx-global-proxy-read-timeout: $(fn-nginx-global-proxy-read-timeout "$APP")"
"--nginx-x-forwarded-for-value: $(fn-nginx-x-forwarded-for-value "$APP")"
"--nginx-computed-x-forwarded-for-value: $(fn-nginx-computed-x-forwarded-for-value "$APP")"
"--nginx-global-x-forwarded-for-value: $(fn-nginx-global-x-forwarded-for-value "$APP")"
"--nginx-x-forwarded-port-value: $(fn-nginx-x-forwarded-port-value "$APP")"
"--nginx-computed-x-forwarded-port-value: $(fn-nginx-computed-x-forwarded-port-value "$APP")"
"--nginx-global-x-forwarded-port-value: $(fn-nginx-global-x-forwarded-port-value "$APP")"
"--nginx-x-forwarded-proto-value: $(fn-nginx-x-forwarded-proto-value "$APP")"
"--nginx-computed-x-forwarded-proto-value: $(fn-nginx-computed-x-forwarded-proto-value "$APP")"
"--nginx-global-x-forwarded-proto-value: $(fn-nginx-global-x-forwarded-proto-value "$APP")"
"--nginx-x-forwarded-ssl: $(fn-nginx-x-forwarded-ssl "$APP")"
"--nginx-computed-x-forwarded-ssl: $(fn-nginx-computed-x-forwarded-ssl "$APP")"
"--nginx-global-x-forwarded-ssl: $(fn-nginx-global-x-forwarded-ssl "$APP")"
)
if [[ -z "$INFO_FLAG" ]]; then