
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "sonarqube.fullname" . }}-config
  labels:
    app: {{ template "sonarqube.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  {{- if and .Values.sonarSecretKey (not .Values.sonarProperties) (not .Values.elasticsearch.bootstrapChecks) }}
  sonar.properties: sonar.secretKeyPath={{ .Values.sonarqubeFolder }}/secret/sonar-secret.txt
  {{- end }}
  {{- if or .Values.sonarProperties (not .Values.elasticsearch.bootstrapChecks) }}
  sonar.properties:
  {{ range $key, $val := .Values.sonarProperties }}
    {{ $key }}={{ $val }}
  {{ end }}
  {{- if not .Values.elasticsearch.bootstrapChecks }}
    sonar.es.bootstrap.checks.disable=true
  {{- end }}
  {{- end }}
    {{- if and .Values.sonarSecretKey .Values.sonarProperties }}
      sonar.secretKeyPath={{ .Values.sonarqubeFolder }}/secret/sonar-secret.txt
    {{- end }}
