{{- include "common.values.setup" . -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "common.names.fullname" . }}-settings
  labels:
    {{- include "common.labels" . | nindent 4 }}
data:
  config.yml: |
{{- range $name, $config := .Values.config }}
{{- if or (eq $name "detectors") (eq $name "notify") }}
    {{ $name }}:
      {{- range $innerName, $innerConfig := $config }}
        {{- if $innerConfig.enabled }}
        {{- $newInnerConfig := omit $innerConfig "enabled" }}
      {{ $innerName }}:{{ toYaml $newInnerConfig | nindent 8 }}
        {{- end }}
      {{- end }}
{{- else }}
    {{ $name }}:{{ toYaml $config | nindent 6 }}
{{- end }}
{{- end }}
