Skip to content

Commit a2bc201

Browse files
committed
fix api variables
1 parent 74e01ea commit a2bc201

5 files changed

Lines changed: 69 additions & 21 deletions

File tree

charts/bunkerweb/templates/api-deployment.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,40 +48,39 @@ spec:
4848
{{- else }}
4949
value: "{{ include "bunkerweb.databaseUri" . }}"
5050
{{- end }}
51+
{{- if or (and .Values.settings.api.useBearerToken.fromExistingSecret (not (empty .Values.settings.existingSecret))) (and (not .Values.settings.api.useBearerToken.fromExistingSecret) (not (empty .Values.settings.api.useBearerToken.token))) }}
5152
- name: API_TOKEN
52-
{{- if not (empty .Values.settings.existingSecret) }}
53+
{{- if and .Values.settings.api.useBearerToken.fromExistingSecret (not (empty .Values.settings.existingSecret)) }}
5354
valueFrom:
5455
secretKeyRef:
5556
name: "{{ .Values.settings.existingSecret }}"
5657
key: api-token
5758
{{- else }}
58-
value: "{{ .Values.settings.api.apiToken }}"
59+
value: "{{ .Values.settings.api.useBearerToken.token }}"
5960
{{- end }}
61+
{{- end }}
62+
{{- if or (and .Values.settings.api.useUserPass.fromExistingSecret (not (empty .Values.settings.existingSecret))) (and (not .Values.settings.api.useUserPass.fromExistingSecret) (not (empty .Values.settings.api.useUserPass.apiUsername)) (not (empty .Values.settings.api.useUserPass.apiPassword))) }}
6063
- name: API_USERNAME
61-
{{- if not (empty .Values.settings.existingSecret) }}
64+
{{- if and .Values.settings.api.useUserPass.fromExistingSecret (not (empty .Values.settings.existingSecret)) }}
6265
valueFrom:
6366
secretKeyRef:
6467
name: "{{ .Values.settings.existingSecret }}"
6568
key: api-username
6669
{{- else }}
67-
value: "{{ .Values.settings.api.apiUsername }}"
70+
value: "{{ .Values.settings.api.useUserPass.apiUsername }}"
6871
{{- end }}
6972
- name: API_PASSWORD
70-
{{- if not (empty .Values.settings.existingSecret) }}
73+
{{- if and .Values.settings.api.useUserPass.fromExistingSecret (not (empty .Values.settings.existingSecret)) }}
7174
valueFrom:
7275
secretKeyRef:
7376
name: "{{ .Values.settings.existingSecret }}"
7477
key: api-password
7578
{{- else }}
76-
value: "{{ .Values.settings.api.apiPassword }}"
79+
value: "{{ .Values.settings.api.useUserPass.apiPassword }}"
7780
{{- end }}
81+
{{- end }}
82+
{{- if not (empty .Values.settings.api.apiAclBootstrapFile) }}
7883
- name: API_ACL_BOOTSTRAP_FILE
79-
{{- if not (empty .Values.settings.existingSecret) }}
80-
valueFrom:
81-
secretKeyRef:
82-
name: "{{ .Values.settings.existingSecret }}"
83-
key: api-acl-json-file-path
84-
{{- else }}
8584
value: "{{ .Values.settings.api.apiAclBootstrapFile }}"
8685
{{- end }}
8786
- name: API_WHITELIST_ENABLED

charts/bunkerweb/values.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ settings:
5353
# - totp-secrets : TOTP secrets for 2FA
5454
# - mariadb-user : MariaDB username
5555
# - mariadb-password : MariaDB password
56+
# - pro-license-key : BunkerWeb Pro license key
5657
# - api-token : API Bearer token
5758
# - api-username : API username, also require api-password
5859
# - api-password : API password, also require api-username
@@ -147,13 +148,20 @@ settings:
147148
api:
148149
# Authentication settings
149150
# https://docs.bunkerweb.io/latest/api/#authentication
151+
# Choose at least one method of authentication
150152
# API Bearer Token
151-
# Leave Empty if using settings.existingSecret
152-
apiToken: ""
153-
# OR/AND API Username and Password
154-
# Leave Empty if using settings.existingSecret
155-
apiUsername: ""
156-
apiPassword: ""
153+
useBearerToken:
154+
# If enable, it will use settings.existingSecret
155+
fromExistingSecret: false
156+
# If not using existingSecret, set the token here
157+
token: ""
158+
# Username and Password
159+
useUserPass:
160+
# If enable, it will use settings.existingSecret
161+
fromExistingSecret: false
162+
# If not using existingSecret, set the credentials here
163+
apiUsername: ""
164+
apiPassword: ""
157165
# OR/AND ConfigMap name that includes ACL based JSON File
158166
# https://docs.bunkerweb.io/latest/api/#permissions-acl
159167
apiAclBootstrapFile: ""

docs/values.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,15 @@ Configuration for BunkerWeb behavior in Kubernetes environment
613613
| `settings.redis` | Configuration for redis | `object` | See nested values |
614614
| `settings.ui` | Configuration for ui | `object` | See nested values |
615615
| `settings.api.apiAclBootstrapFile` | OR/AND ConfigMap name that includes ACL based JSON File https://docs.bunkerweb.io/latest/api/#permis... | `string` | `""` |
616-
| `settings.api.apiPassword` | Configuration for apiPassword | `string` | `""` |
617-
| `settings.api.apiToken` | Authentication settings https://docs.bunkerweb.io/latest/api/#authentication API Bearer Token Leave ... | `string` | `""` |
618-
| `settings.api.apiUsername` | OR/AND API Username and Password Leave Empty if using settings.existingSecret | `string` | `""` |
619616
| `settings.api.docsUrl` | URL for API documentation, set to an empty value to disable | `string` | `"/docs"` |
620617
| `settings.api.forwardedAllowIps` | Forwarded allow IPs for correct client IP detection | `string` | `"*"` |
621618
| `settings.api.ingress` | Ingress configuration for UI access | `object` | See nested values |
622619
| `settings.api.openApiUrl` | URL for OpenAPI specification, set to an empty value to disable | `string` | `"/openapi.json"` |
623620
| `settings.api.rateLimit` | Rate limiting configuration for API access https://docs.bunkerweb.io/latest/api/#rate-limiting | `object` | See nested values |
624621
| `settings.api.redocUrl` | URL for ReDoc API documentation, set to an empty value to disable | `string` | `"/redoc"` |
625622
| `settings.api.rootPath` | API Configuration https://docs.bunkerweb.io/latest/api/#configuration Root path for the API | `string` | `""` |
623+
| `settings.api.useBearerToken` | Authentication settings https://docs.bunkerweb.io/latest/api/#authentication Choose at least one met... | `object` | See nested values |
624+
| `settings.api.useUserPass` | Username and Password | `object` | See nested values |
626625
| `settings.api.whitelist` | Whitelist configuration for API access | `object` | See nested values |
627626
| `settings.kubernetes.domainName` | Kubernetes cluster domain name for service discovery | `string` | `"cluster.local"` |
628627
| `settings.kubernetes.ignoreAnnotations` | Annotations to be ignored by bunkerweb-controller when multiple ingress controllers (comma-separated... | `string` | `""` |
@@ -651,6 +650,11 @@ Configuration for BunkerWeb behavior in Kubernetes environment
651650
| `settings.api.rateLimit.defaults` | Rate limit per period, Supported formats: "[10/seconde]", "[100/minute]", "[1000/day]" https://limit... | `list` | `['100/minute']` |
652651
| `settings.api.rateLimit.enabled` | Set to true to create an Ingress resource for the UI | `bool` | `true` |
653652
| `settings.api.rateLimit.strategy` | Strategy: "fixed-window" or "moving-window" or "sliding-window" https://limits.readthedocs.io/en/sta... | `string` | `"fixed-window"` |
653+
| `settings.api.useBearerToken.fromExistingSecret` | If enable, it will use settings.existingSecret | `bool` | `false` |
654+
| `settings.api.useBearerToken.token` | If not using existingSecret, set the token here | `string` | `""` |
655+
| `settings.api.useUserPass.apiPassword` | Configuration for apiPassword | `string` | `""` |
656+
| `settings.api.useUserPass.apiUsername` | If not using existingSecret, set the credentials here | `string` | `""` |
657+
| `settings.api.useUserPass.fromExistingSecret` | If enable, it will use settings.existingSecret | `bool` | `false` |
654658
| `settings.api.whitelist.enabled` | Set to true to create an Ingress resource for the UI | `bool` | `true` |
655659
| `settings.api.whitelist.whitelistIps` | space-separated list of IPs/CIDR allowed to access the API | `string` | `"10.0.0.0/8"` |
656660
| `settings.ui.ingress.enabled` | Set to true to create an Ingress resource for the UI | `bool` | `false` |

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This directory contains example configurations for common BunkerWeb deployment s
88

99
### Basic Configurations
1010

11+
- [`bunkerweb-settings-secret.yaml`](bunkerweb-settings-secret.yaml) - Secret with all sensitive variables example
1112
- [`all-in-one.yaml`](all-in-one.yaml) - Full stack configuration for testing
1213
- [`production.yaml`](production.yaml) - Production-ready setup with persistence and external services
1314

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# BunkerWeb Settings Secret
2+
# This Secret contains sensitive configuration settings for BunkerWeb.
3+
# Modify the values as needed for your deployment
4+
# Make sure to reference this secret in your Helm values under settings.existingSecret
5+
apiVersion: v1
6+
kind: Secret
7+
metadata:
8+
name: bunkerweb-settings-secret
9+
namespace: bunkerweb
10+
type: Opaque
11+
stringData:
12+
# Database URI for BunkerWeb (SQLAlchemy/PyMySQL format)
13+
database-uri: "mysql+pymysql://bunkerweb:changeme@mariadb-bunkerweb.bunkerweb.svc.cluster.local:3306/db?ssl_verify_cert=False"
14+
# Redis username (if authentication enabled)
15+
redis-username: ""
16+
# Redis password (required for Redis and Scheduler)
17+
redis-password: "changeme"
18+
# UI Admin credentials
19+
admin-username: "admin"
20+
admin-password: "changeMe123!"
21+
# Flask secret key for UI sessions (generate a random string)
22+
flask-secret: "flask-secret-of-the-titans"
23+
# TOTP secrets for 2FA (generate a random string)
24+
totp-secrets: "totp-secrets-of-the-gods"
25+
# BunkerWeb database user
26+
mariadb-user: "bunkerweb"
27+
# BunkerWeb database password
28+
mariadb-password: "changeme"
29+
# BunkerWeb Pro license key
30+
pro-license-key: "bw-pro-license-key-goes-here"
31+
# API token for accessing BunkerWeb API
32+
api-token: ""
33+
# api username
34+
api-username: "admin"
35+
# api password
36+
api-password: "changeMe123!"

0 commit comments

Comments
 (0)