apiVersion: v1
kind: Secret
metadata:
  name: {{ include "plateformcoop-ebs" . }}
  labels:
    {{- include "plateformcoop-ebs.labels" . | nindent 4 }}
type: Opaque
data:
  {{- if .Values.postgresql.enabled }}
  database-url: {{ printf "pgsql://%s:%s@%s-postgresql/%s?serverVersion=14&charset=utf8" .Values.postgresql.global.postgresql.auth.username .Values.postgresql.global.postgresql.auth.password .Release.Name .Values.postgresql.global.postgresql.auth.database | b64enc | quote }}
  {{- else }}
  database-url: {{ .Values.postgresql.url | b64enc | quote }}
  {{- end }}
  php-app-secret: {{ .Values.php.appSecret | default (randAlphaNum 40) | b64enc | quote }}
  php-jwt-passphrase: {{ .Values.php.jwt.passphrase | b64enc | quote }}
  php-jwt-public-key: {{ .Values.php.jwt.publicKey | b64enc | quote }}
  php-jwt-secret-key: {{ .Values.php.jwt.secretKey | b64enc | quote }}
  mercure-jwt-secret: {{ .Values.mercure.jwtSecret | default (randAlphaNum 40) | b64enc | quote }}
  {{- if .Values.maildev.enabled }}
  mailer-dsn: {{ printf "smtp://%s:%s" ( include "maildev.fullname" .Subcharts.maildev ) "1025" | b64enc | quote }}
  {{- else }}
  mailer-dsn: {{ .Values.mailer.dsn | b64enc | quote }}
  {{- end }}
  sms-dsn: {{ .Values.sms.dsn | b64enc | quote }}
  payum-apikey: {{ .Values.payum.apikey | b64enc | quote }}
  php-storage-key: {{ .Values.php.storage.key | b64enc | quote }}
  php-storage-secret: {{ .Values.php.storage.secret | b64enc | quote }}