Skip to content

Commit

Permalink
fix: unify secret handling for hydra (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonsthere authored Dec 1, 2023
1 parent ac2b530 commit 5a36d40
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
7 changes: 7 additions & 0 deletions hacks/values/hydra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ hydra:
- "foo bar 123 456 lorem 1"
- "foo bar 123 456 lorem 2"
- "foo bar 123 456 lorem 3"
cookie:
- "OG5XbmxXa3dYeGplQXpQanYxeEFuRUFa"
- "foo bar 123 456 lorem"
- "foo bar 123 456 lorem 1"
- "foo bar 123 456 lorem 2"
- "foo bar 123 456 lorem 3"

maester:
enabled: false

Expand Down
18 changes: 13 additions & 5 deletions helm/charts/hydra/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,19 @@ Generate the secrets.system value
Generate the secrets.cookie value
*/}}
{{- define "hydra.secrets.cookie" -}}
{{- if (.Values.hydra.config.secrets).cookie -}}
{{- .Values.hydra.config.secrets.cookie }}
{{- else -}}
{{- include "hydra.secrets.system" . }}
{{- end -}}
{{- if (.Values.hydra.config.secrets).cookie -}}
{{- if kindIs "slice" .Values.hydra.config.secrets.cookie -}}
{{- if gt (len .Values.hydra.config.secrets.cookie) 1 -}}
"{{- join "\",\"" .Values.hydra.config.secrets.cookie -}}"
{{- else -}}
{{- join "" .Values.hydra.config.secrets.cookie -}}
{{- end -}}
{{- else -}}
{{- fail "Expected hydra.config.secrets.cookie to be a list of strings" -}}
{{- end -}}
{{- else -}}
{{- include "hydra.secrets.system" . }}
{{- end -}}
{{- end -}}
{{/*
Expand Down

0 comments on commit 5a36d40

Please sign in to comment.