# --------------------------------------------------------------------
# Copyright (c) 2020, WSO2 Inc. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------

# Config map containing config.toml file for adapter

apiVersion: v1
kind: ConfigMap
metadata:
  name: config-toml
data:
  config.toml: |
    [adapter]
    [adapter.server]
      enabled = true
      port = "9843"
      tokenPrivateKeyPath = "/home/wso2/security/keystore/mg.key"
      [[adapter.server.users]]
        username = "admin"
        password = "$env{adapter_admin_pwd}"

    # default vhosts mapping for standalone mode
    [[adapter.vhostMapping]]
      environment = "Default"
      vhost = "gw.wso2.com"

    [adapter.keystore]
      certPath = "/home/wso2/security/keystore/mg.pem"
      keyPath = "/home/wso2/security/keystore/mg.key"

    [adapter.truststore]
      location = "/home/wso2/security/truststore"

    [router]
      listenerPort = 9090
      securedListenerPort = 9095
      systemHost = "gw.wso2.com"

    [router.keystore]
      certPath = "/home/wso2/security/keystore/mg.pem"
      keyPath = "/home/wso2/security/keystore/mg.key"

    [router.upstream]
    [router.upstream.tls]
      trustedCertPath = "/etc/ssl/certs/ca-certificates.crt"
      verifyHostName = true
      disableSslVerification = false

    [enforcer]
    [enforcer.jwtIssuer]
      enabled = true
      issuer = "https://gw.wso2.com/testkey"

    [enforcer.security]
    [[enforcer.security.tokenService]]
      name = "Resident Key Manager"
      issuer = "https://apim.wso2.com/oauth2/token"
      certificateAlias = "wso2carbon"
      jwksURL = ""
      validateSubscription = false
      consumerKeyClaim = "azp"
      certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem"

    [[enforcer.security.tokenService]]
      name = "MGW"
      issuer = "https://gw.wso2.com/testkey"
      certificateAlias = "mgw"
      jwksURL = ""
      validateSubscription = false
      consumerKeyClaim = ""
      certificateFilePath = "/home/wso2/security/truststore/mg.pem"

    [[enforcer.security.tokenService]]
      name = "APIM Publisher"
      issuer = "https://apim.wso2.com/publisher"
      validateSubscription = true
      certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem"

    [enforcer.throttling]
      enableGlobalEventPublishing = false
      jmsConnectionProviderURL = "amqp://admin:$env{tm_admin_pwd}@carbon/carbon?brokerlist='tcp://apim:5672'"
      [enforcer.throttling.publisher]
        username = "admin"
        password = "$env{tm_admin_pwd}"
        [[enforcer.throttling.publisher.URLGroup]]
          receiverURLs = ["tcp://apim:9611"]
          authURLs = ["ssl://apim:9711"]

    [analytics]
      enabled = false

    [enforcer.metrics]
      enabled = false

