{{- if or (and (not .Values.backend.config.smtp.existingSecret) .Values.backend.config.smtp.password) (and (not .Values.backend.config.djangoExistingSecretKey) .Values.backend.config.djangoSecretKey) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "ciso-assistant.fullname" . }}-backend
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "ciso-assistant.labels" (dict "context" . "component" "backend") | nindent 4 }}
type: Opaque
data:
  {{- if and (not .Values.backend.config.djangoExistingSecretKey) .Values.backend.config.djangoSecretKey }}
  django-secret-key: {{ .Values.backend.config.djangoSecretKey | b64enc | quote}}
  {{- end }}
  {{- if and (not .Values.backend.config.smtp.existingSecret) .Values.backend.config.smtp.password }}
  email-primary-password: {{ .Values.backend.config.smtp.password | b64enc | quote}}
  {{- end }}
{{- end }}
