{{- include "certctl.validateAuthType" . }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "certctl.fullname" . }}-server
  labels:
    {{- include "certctl.labels" . | nindent 4 }}
    app.kubernetes.io/component: server
type: Opaque
stringData:
  database-url: postgres://{{ .Values.postgresql.auth.username }}:$(POSTGRES_PASSWORD)@{{ include "certctl.fullname" . }}-postgres:5432/{{ .Values.postgresql.auth.database }}?sslmode=disable
  {{- if and (eq .Values.server.auth.type "api-key") .Values.server.auth.apiKey }}
  api-key: {{ .Values.server.auth.apiKey | quote }}
  {{- end }}
  {{- if .Values.server.smtp.enabled }}
  smtp-password: {{ .Values.server.smtp.password | quote }}
  {{- end }}
