apiVersion: v1
kind: ConfigMap
metadata:
  name: platform-gateway-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 }}
    spring:
      cloud:
        gateway:
          routes:
            - id: data-factory
              uri: http://no-op
              predicates:
                - Path=/data-factory/{registry}/**
                - Method=GET,POST
              filters:
                - name: ClientRegistrySetToken
                  args:
                    header: X-Access-Token
                - name: KubernetesUrlMapping
                  args:
                    serviceUrlPattern: {{ .Values.restApi.externalRegistry.root.urlPattern }}
                - StripPrefix=2
            - id: bp-gateway
              uri: http://no-op
              predicates:
                - Path=/bp-gateway/{registry}/**
                - Method=POST
              filters:
                - name: ClientRegistrySetToken
                  args:
                    header: X-Access-Token
                - name: KubernetesUrlMapping
                  args:
                    serviceUrlPattern: {{ .Values.bpGateway.root.urlPattern }}
                - StripPrefix=2
            - id: public-api
              uri: {{ .Values.restApi.public.root.urlPattern }}
              predicates:
                - Path=/api/public/data-factory/**
                - Method=GET,POST
              filters:
                - name: PublicApiAddToken
                  args:
                    header: X-Access-Token
                - StripPrefix=3    

    vault:
      uri: https://hashicorp-vault-user-management.{{ .Values.dnsWildcard }}

    registry:
      name: {{ .Values.namespace }}
    
    keycloak:
      url: {{ template "keycloak.url" . }}
      public-api:
        realm: {{ .Values.namespace }}-{{ .Values.keycloak.realms.externalSystem }}
        client-id: {{ .Values.keycloak.publicApiClient.clientName }}