@@ -130,6 +130,30 @@ REDIS settings
130130{{- end }}
131131{{- end }}
132132
133+ {{/*
134+ Whether the external API component must run.
135+ True when the API is explicitly enabled, or when MCP is enabled and points at
136+ the internal API (mcp.config.bunkerwebBaseUrl empty) — MCP depends on it.
137+ */ }}
138+ {{- define " bunkerweb.apiEnabled" -}}
139+ {{- if or .Values.api.enabled (and .Values.mcp.enabled (empty .Values.mcp.config.bunkerwebBaseUrl )) -}}
140+ true
141+ {{- end -}}
142+ {{- end -}}
143+
144+ {{/*
145+ Whether any API authentication method is configured.
146+ */ }}
147+ {{- define " bunkerweb.apiAuthConfigured" -}}
148+ {{- $s := .Values.settings.api -}}
149+ {{- $hasToken := or (and $s .useBearerToken.fromExistingSecret (not (empty .Values.settings.existingSecret ))) (and (not $s .useBearerToken.fromExistingSecret ) (not (empty $s .useBearerToken.token ))) -}}
150+ {{- $hasUserPass := or (and $s .useUserPass.fromExistingSecret (not (empty .Values.settings.existingSecret ))) (and (not $s .useUserPass.fromExistingSecret ) (not (empty $s .useUserPass.apiUsername )) (not (empty $s .useUserPass.apiPassword ))) -}}
151+ {{- $hasAcl := not (empty $s .apiAclBootstrapFile ) -}}
152+ {{- if or $hasToken $hasUserPass $hasAcl -}}
153+ true
154+ {{- end -}}
155+ {{- end -}}
156+
133157{{/*
134158Generate BunkerWeb feature environment variables
135159*/ }}
@@ -150,6 +174,14 @@ Generate BunkerWeb feature environment variables
150174- name: DISABLE_DEFAULT_SERVER_STRICT_SNI
151175 value: {{ .global.disableDefaultServerStrictSni | quote }}
152176{{- end }}
177+ {{- if and .global.maxHeaders (ne .global.maxHeaders " " ) }}
178+ - name: MAX_HEADERS
179+ value: {{ .global.maxHeaders | quote }}
180+ {{- end }}
181+ {{- if and .global.workerShutdownTimeout (ne .global.workerShutdownTimeout " " ) }}
182+ - name: WORKER_SHUTDOWN_TIMEOUT
183+ value: {{ .global.workerShutdownTimeout | quote }}
184+ {{- end }}
153185
154186# =============================================================================
155187# NGINX TIMEOUTS
@@ -238,9 +270,17 @@ Generate BunkerWeb feature environment variables
238270- name: MODSECURITY_CRS_PLUGINS
239271 value: {{ .modsecurity.modsecurityCrsPlugins | quote }}
240272{{- end }}
273+ {{- if and .modsecurity .modsecurity.modsecuritySecRequestBodyLimit (ne .modsecurity.modsecuritySecRequestBodyLimit " " ) }}
274+ - name: MODSECURITY_SEC_REQUEST_BODY_LIMIT
275+ value: {{ .modsecurity.modsecuritySecRequestBodyLimit | quote }}
276+ {{- end }}
277+ {{- if and .modsecurity .modsecurity.modsecuritySecRequestBodyLimitAction (ne .modsecurity.modsecuritySecRequestBodyLimitAction " " ) }}
278+ - name: MODSECURITY_SEC_REQUEST_BODY_LIMIT_ACTION
279+ value: {{ .modsecurity.modsecuritySecRequestBodyLimitAction | quote }}
280+ {{- end }}
241281
242282# =============================================================================
243- # ANTIBOT PROTECTION
283+ # ANTIBOT PROTECTION
244284# =============================================================================
245285{{- if and .antibot .antibot.useAntibot (ne .antibot.useAntibot " " ) }}
246286- name: USE_ANTIBOT
@@ -270,6 +310,10 @@ Generate BunkerWeb feature environment variables
270310- name: ANTIBOT_RECAPTCHA_CLASSIC
271311 value: {{ .antibot.antibotRecaptchaClassic | quote }}
272312{{- end }}
313+ {{- if and .antibot .antibot.antibotRdnsGlobal (ne .antibot.antibotRdnsGlobal " " ) }}
314+ - name: ANTIBOT_RDNS_GLOBAL
315+ value: {{ .antibot.antibotRdnsGlobal | quote }}
316+ {{- end }}
273317
274318# =============================================================================
275319# RATE LIMITING
@@ -445,6 +489,10 @@ Generate BunkerWeb feature environment variables
445489- name: LETS_ENCRYPT_ZEROSSL_API_RETRY_DELAY
446490 value: {{ .letsEncrypt.letsEncryptZerosslApiRetryDelay | quote }}
447491{{- end }}
492+ {{- if and .letsEncrypt .letsEncrypt.letsEncryptMaxLogBackups (ne .letsEncrypt.letsEncryptMaxLogBackups " " ) }}
493+ - name: LETS_ENCRYPT_MAX_LOG_BACKUPS
494+ value: {{ .letsEncrypt.letsEncryptMaxLogBackups | quote }}
495+ {{- end }}
448496
449497# Custom SSL certificate
450498{{- if and .customSsl .customSsl.useCustomSsl (ne .customSsl.useCustomSsl " " ) }}
@@ -537,6 +585,18 @@ Generate BunkerWeb feature environment variables
537585- name: REVERSE_PROXY_READ_TIMEOUT
538586 value: {{ .reverseProxy.reverseProxyReadTimeout | quote }}
539587{{- end }}
588+ {{- if and .reverseProxy .reverseProxy.reverseProxyKeepalive (ne .reverseProxy.reverseProxyKeepalive " " ) }}
589+ - name: REVERSE_PROXY_KEEPALIVE
590+ value: {{ .reverseProxy.reverseProxyKeepalive | quote }}
591+ {{- end }}
592+ {{- if and .reverseProxy .reverseProxy.reverseProxyHttpVersion (ne .reverseProxy.reverseProxyHttpVersion " " ) }}
593+ - name: REVERSE_PROXY_HTTP_VERSION
594+ value: {{ .reverseProxy.reverseProxyHttpVersion | quote }}
595+ {{- end }}
596+ {{- if and .reverseProxy .reverseProxy.reverseProxyModsecurity (ne .reverseProxy.reverseProxyModsecurity " " ) }}
597+ - name: REVERSE_PROXY_MODSECURITY
598+ value: {{ .reverseProxy.reverseProxyModsecurity | quote }}
599+ {{- end }}
540600
541601# =============================================================================
542602# GRPC REVERSE PROXY
@@ -749,6 +809,10 @@ Generate BunkerWeb feature environment variables
749809- name: SESSIONS_CHECK_USER_AGENT
750810 value: {{ .sessions.sessionsCheckUserAgent | quote }}
751811{{- end }}
812+ {{- if and .sessions .sessions.sessionsDomain (ne .sessions.sessionsDomain " " ) }}
813+ - name: SESSIONS_DOMAIN
814+ value: {{ .sessions.sessionsDomain | quote }}
815+ {{- end }}
752816
753817# =============================================================================
754818# METRICS AND MONITORING
@@ -765,10 +829,22 @@ Generate BunkerWeb feature environment variables
765829- name: METRICS_MAX_BLOCKED_REQUESTS
766830 value: {{ .metrics.metricsMaxBlockedRequests | quote }}
767831{{- end }}
832+ {{- if and .metrics .metrics.metricsMaxBlockedRequestsRedis (ne .metrics.metricsMaxBlockedRequestsRedis " " ) }}
833+ - name: METRICS_MAX_BLOCKED_REQUESTS_REDIS
834+ value: {{ .metrics.metricsMaxBlockedRequestsRedis | quote }}
835+ {{- end }}
768836{{- if and .metrics .metrics.metricsSaveToRedis (ne .metrics.metricsSaveToRedis " " ) }}
769837- name: METRICS_SAVE_TO_REDIS
770838 value: {{ .metrics.metricsSaveToRedis | quote }}
771839{{- end }}
840+ {{- if and .metrics .metrics.maxLruHistory (ne .metrics.maxLruHistory " " ) }}
841+ - name: MAX_LRU_HISTORY
842+ value: {{ .metrics.maxLruHistory | quote }}
843+ {{- end }}
844+ {{- if and .metrics .metrics.datastoreLruSize (ne .metrics.datastoreLruSize " " ) }}
845+ - name: DATASTORE_LRU_SIZE
846+ value: {{ .metrics.datastoreLruSize | quote }}
847+ {{- end }}
772848
773849# =============================================================================
774850# AUTH BASIC
0 commit comments