apiVersion: v1
kind: Secret
metadata:
  name: {{ include "formbricks.fullname" . }}-secrets
type: Opaque
stringData:
  {{- if .Values.postgresql.externalUrl }}
  DATABASE_URL: {{ .Values.postgresql.externalUrl }}
  {{- else if .Values.postgresql.enabled }}
  DATABASE_URL: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql:5432/{{ .Values.postgresql.auth.database }}
  {{- end }}
  {{- if .Values.redis.externalUrl }}
  REDIS_URL: {{ .Values.redis.externalUrl }}
  {{- else if .Values.redis.enabled }}
  REDIS_URL: redis://:{{ .Values.redis.auth.password }}@{{ .Release.Name }}-redis-master:6379
  {{- end }}
  NEXTAUTH_SECRET: {{ .Values.formbricksConfig.nextAuthSecret | default (randAlphaNum 32) | quote }}
  ENCRYPTION_KEY: {{ .Values.formbricksConfig.encryptionKey | default (randAlphaNum 32) | quote }}
  CRON_SECRET: {{ .Values.formbricksConfig.cronSecret | default (randAlphaNum 32) | quote }}