{{- if and .Values.copilot.enabled .Values.copilot.server.secret.create (not (and .Values.externalSecrets .Values.externalSecrets.enabled)) }} apiVersion: v1 kind: Secret metadata: name: {{ include "sim.copilot.envSecretName" . }} namespace: {{ .Release.Namespace }} labels: {{- include "sim.copilot.labels" . | nindent 4 }} {{- with .Values.copilot.server.secret.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} type: Opaque stringData: {{- range $key, $value := .Values.copilot.server.env }} {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} {{- if and .Values.copilot.enabled (not .Values.copilot.postgresql.enabled) (or (not .Values.copilot.database.existingSecretName) (eq .Values.copilot.database.existingSecretName "")) (ne .Values.copilot.database.url "") }} --- apiVersion: v1 kind: Secret metadata: name: {{ include "sim.copilot.databaseSecretName" . }} namespace: {{ .Release.Namespace }} labels: {{- include "sim.copilot.labels" . | nindent 4 }} {{- with .Values.copilot.server.secret.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} type: Opaque stringData: {{ include "sim.copilot.databaseSecretKey" . }}: {{ required "copilot.database.url is required when using an external database" .Values.copilot.database.url | quote }} {{- end }}