{{- if .Values.global.notifications.email }}
{{- if or (not .Values.global.excludePortals) (not (has "citizen" .Values.global.excludePortals)) }}
apiVersion: v1
kind: Secret
metadata:
  name: notification-service-channel-configuration
  namespace: {{ .Release.Namespace }}
  labels:
    spring.cloud.kubernetes.secret: 'true'
data:
  {{- if eq .Values.global.notifications.email.type "internal" }}
  notifications.email.username: {{ (lookup "v1" "Secret" .Release.Namespace "smtp-internal-credentials").data.username }}
  notifications.email.password: {{ (lookup "v1" "Secret" .Release.Namespace "smtp-internal-credentials").data.password }}
  {{- else }}
  notifications.email.username: {{ .Values.global.notifications.email.address | b64enc }}
  notifications.email.password: {{ .Values.global.notifications.email.password }}
  {{- end }}
{{- end }}
{{- end }}