apiVersion: v1
kind: Secret
metadata:
  name: {{ template "prisma.fullname" . }}
  labels:
    app: {{ template "prisma.name" . }}
    chart: {{ template "prisma.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
  {{- if and .Values.auth.enabled .Values.auth.secret }}
  api-secret: {{ .Values.auth.secret | b64enc | quote }}
  {{- else if .Values.auth.enabled }}
  api-secret: {{ randAlphaNum 40 | b64enc | quote }}
  {{- end }}
  db-user: {{ .Values.database.user | b64enc | quote }}
  {{- if not .Values.postgresql.enabled }}
  {{- if .Values.database.password }}
  db-password: {{ .Values.database.password | b64enc | quote }}
  {{- else }}
  db-password: {{ randAlphaNum 40 | b64enc | quote }}
  {{- end }}
  {{- end }}
