Skip to content

Commit 4cec00c

Browse files
authored
Generate secret key if not set (#118)
1 parent 305c1c4 commit 4cec00c

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

charts/flagsmith/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: flagsmith
33
description: Flagsmith
44
type: application
5-
version: 0.12.0
5+
version: 0.13.0
66
appVersion: 2.34.0
77
dependencies:
88
- name: postgresql

charts/flagsmith/templates/NOTES.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ for information about how to gain web access to the application.
3030
##### Warning: no secret key set #####
3131
######################################
3232

33-
No secret key is set. For production systems, it is strongly
34-
recommended to generate a large random value and set it at
35-
`api.secretKey`. It must be kept secret.
33+
No secret key is set, a new one will be randomly generated at each
34+
deployment. For production systems, it is strongly recommended to
35+
generate a large random value and set it at `api.secretKey`. It must
36+
be kept secret.
3637

3738
See https://docs.flagsmith.com/deployment/locally-api#creating-a-secret-key
3839
{{- end }}

charts/flagsmith/templates/_api_environment.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
name: {{ template "flagsmith.fullname" . }}
99
key: DATABASE_URL
1010
{{- end }}
11-
{{- if .Values.api.secretKey }}
1211
- name: DJANGO_SECRET_KEY
1312
valueFrom:
1413
secretKeyRef:
1514
name: {{ template "flagsmith.fullname" . }}
1615
key: DJANGO_SECRET_KEY
17-
{{- end }}
1816
{{- if .Values.influxdb2.enabled }}
1917
- name: INFLUXDB_URL
2018
value: http://{{- template "flagsmith.influxdb.hostname" . -}}:80
@@ -87,4 +85,4 @@
8785
{{- if and .Values._destructiveTests.enabled .Values._destructiveTests.testToken }}
8886
- name: E2E_TEST_AUTH_TOKEN
8987
value: {{ .Values._destructiveTests.testToken | quote }}
90-
{{- end }}
88+
{{- end }}

charts/flagsmith/templates/secrets-api.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ metadata:
88
type: Opaque
99
data:
1010
DATABASE_URL: {{ include "flagsmith.api.databaseUrl" . | trim | b64enc | quote }}
11-
{{- with .Values.api.secretKey }}
12-
DJANGO_SECRET_KEY: {{ . | b64enc | quote }}
13-
{{- end }}
11+
DJANGO_SECRET_KEY: {{ .Values.api.secretKey | default (randAlphaNum 50) | b64enc | quote }}

0 commit comments

Comments
 (0)