{{- if or (not .Values.global.excludePortals) (not (has "citizen" .Values.global.excludePortals)) (not (has "officer" .Values.global.excludePortals)) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: user-settings-service-api-properties
data:
  config.yaml: |-
    server.max-http-header-size: 32KB
    {{- if eq .Values.deployProfile "dev" }}
    management.endpoints.web.exposure.include: '*'
    {{- else }}
    management.endpoints.web.exposure.include: 'health, prometheus'
    {{- end }}

    data-platform:
      datasource:
        url: jdbc:postgresql://{{.Values.db.url}}:{{.Values.db.port}}/{{.Values.db.name}}?ApplicationName={{ .Chart.Name }}
        connection-timeout: {{.Values.db.connectionTimeout}}
      kafka:
        producer:
          enabled: true
        bootstrap: {{ .Values.kafka.service }}
        ssl:
          enabled: {{ .Values.kafka.sslEnabled }}
          keystore-type: {{ .Values.kafka.sslCertType }}
          truststore-type: {{ .Values.kafka.sslCertType }}
          keystore-certificate: {{ .Values.kafka.sslUserCertificate }}
          keystore-key: {{ .Values.kafka.sslUserKey }}
          truststore-certificate: {{ .Values.kafka.sslClusterCertificate }}


    platform:
      security:
        csrf:
          enabled: {{ .Values.platform.security.csrf.enabled }}

    audit:
      kafka:
        bootstrap: {{ .Values.kafka.service }}
        topic: {{ .Values.audit.kafka.topic }}
        schema-registry-url: {{ .Values.audit.kafka.schemaRegistryUrl }}
        ssl:
          enabled: {{ .Values.kafka.sslEnabled }}
          keystore-certificate: {{ .Values.kafka.sslUserCertificate }}
          keystore-key: {{ .Values.kafka.sslUserKey }}
          truststore-certificate: {{ .Values.kafka.sslClusterCertificate }}

    verification:
      otp:
        time-to-live: {{ .Values.verification.otp.timeToLive }}
{{- end }}