apiVersion: v1
kind: ConfigMap
metadata:
  name: registry-regulation-management-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 }}
    s3:
      config:
        client: {{ .Values.s3.config.client | toYaml | nindent 10 }}
        options: {{ .Values.s3.config.options | toYaml | nindent 10 }}

    user-import-ceph:
      http-endpoint: {{ .Values.userImportCeph.httpEndpoint }}
      bucketName: {{ .Values.userImportCeph.bucketName }}

    data:
      jobName: {{ .Values.data.jobName }}

    gerrit:
      url: {{ template "gerrit.url" . }}
      repository: {{ .Values.gerrit.repository }}
      headBranch: {{ .Values.gerrit.headBranch }}
      repositoryDirectory: {{ .Values.gerrit.repositoryDirectory }}

    registry-regulation-management:
      retry:
        head-branch-cloning-delay: {{ .Values.registryRegulationManagement.retry.headBranchCloningDelay }}
        data-model-context-creating-delay: {{ .Values.registryRegulationManagement.retry.dataModelContextCreatingDelay }}
      data-source:
        driver-class-name: {{ .Values.registryRegulationManagement.dataSource.driverClassName }}
        base-jdbc-url: jdbc:postgresql://{{.Values.db.url}}:{{.Values.db.port}}
        registry-data-base: {{ .Values.registryRegulationManagement.dataSource.registryDataBase }}
        registry-dev-data-base-prefix: {{ .Values.registryRegulationManagement.dataSource.registryDevDataBasePrefix }}
        connection-timeout-in-millis: {{ .Values.registryRegulationManagement.dataSource.connectionTimeoutInMillis }}
      subject-table-name: {{ .Values.registryRegulationManagement.subjectTableName }}
      scheduled:
        clean-obsolete-version-contexts:
          cron: {{ .Values.registryRegulationManagement.scheduled.cleanObsoleteVersionContexts.cron }}
          timezone: {{ .Values.registryRegulationManagement.scheduled.cleanObsoleteVersionContexts.timezone }}
        version-candidate-repo-refresh:
          cron: {{ .Values.scheduled.repositoryRefreshCron }}
          timezone: {{ .Values.scheduled.repositoryRefreshTimezone }}
        master-repo-refresh:
          cron: {{ .Values.registryRegulationManagement.scheduled.masterRepoRefresh.cron }}
          timezone: {{ .Values.registryRegulationManagement.scheduled.masterRepoRefresh.timezone }}
      data-model:
        tables-file-path: {{ .Values.registryRegulationManagement.dataModel.tablesFilePath }}

    spring:
      registry-datasource:
        jdbc-url: jdbc:postgresql://{{.Values.db.url}}:{{.Values.db.port}}/registry?ApplicationName={{ .Chart.Name }}
      public-datasource:
        jdbc-url: jdbc:postgresql://{{.Values.db.url}}:{{.Values.db.port}}/public?ApplicationName={{ .Chart.Name }}
      cache:
        cache-names: {{.Values.cache.names}}
        caffeine:
          spec: {{.Values.cache.spec}}
