{{- $secrets := .Values.secrets }}

{{- if or (not $secrets.JWT_SECRET) (eq $secrets.JWT_SECRET "change_me") }}
  {{- fail "secrets.JWT_SECRET must be overridden and cannot be 'change_me'" }}
{{- end }}

{{- if or (not $secrets.REFRESH_TOKEN_SECRET) (eq $secrets.REFRESH_TOKEN_SECRET "change_me") }}
  {{- fail "secrets.REFRESH_TOKEN_SECRET must be overridden and cannot be 'change_me'" }}
{{- end }}

apiVersion: v1
kind: Secret
metadata:
  name: checkmate-secrets
type: Opaque
stringData:
{{- range $key, $value := $secrets }}
  {{ $key }}: {{ $value | quote }}
{{- end }}