{{- if .Values.serverDefinitions.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "pgadmin4.fullname" . }}-server-definitions
  {{- with .Values.commonLabels }}
  labels: {{ . | toYaml | nindent 4 }}
  {{- end }}
  {{- with .Values.commonAnnotations }}
  annotations: {{ . | toYaml | nindent 4 }}
  {{- end }}
data:
{{- $variableToPreserveTPL := tpl (dict "Servers" .Values.serverDefinitions.data | toYaml) . | fromYaml }}
{{- include "tpl.preserve.variable" $variableToPreserveTPL }}
  servers.json: | {{ $variableToPreserveTPL | toPrettyJson | nindent 4 }}
{{- end }}
