apiVersion: v1
kind: Secret
metadata:
  name: {{ include "api.fullname" . }}
  labels:
    {{- include "api.labels" . | nindent 4 }}
type: Opaque
data:
  {{- if .Values.postgresql.enabled }}
  {{- $postgresqlFullName := include "postgresql.fullname" . }}
  database-url: {{ printf "pgsql://%s:%s@%s-postgresql/%s?serverVersion=12" .Values.postgresql.postgresqlUsername .Values.postgresql.postgresqlPassword $postgresqlFullName .Values.postgresql.postgresqlDatabase | b64enc | quote }}
  {{- else }}
  database-url: {{ .Values.postgresql.url | b64enc | quote }}
  {{- end }}
  secret: {{ .Values.php.secret | default (randAlphaNum 40) | b64enc | quote }}
  mercure-jwt-token: {{ .Values.php.mercure.jwtToken | b64enc | quote }}
