#Copyright (c)  WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you 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.

apiVersion: v1
kind: ConfigMap
metadata:
  name: mgw-conf-mustache
  namespace: wso2-system
data:
  mgwConf.gotmpl: |

    #Copyright (c)  WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
    #
    # WSO2 Inc. licenses this file to you 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.

    [listenerConfig]
    host="0.0.0.0"
    httpPort={{httpPort}}
    httpsPort={{httpsPort}}
    keyStore.path="{{keystorePath}}"
    keyStore.password="{{keystorePassword}}"
    trustStore.path="{{truststorePath}}"
    trustStore.password="{{truststorePassword}}"
    tokenListenerPort=9096

    [authConfig]
    authorizationHeader="Authorization"
    removeAuthHeaderFromOutMessage=true

    [keyManager]
    serverUrl="{{keymanagerServerurl}}"
    username="{{keymanagerUsername}}"
    password="{{keymanagerPassword}}"
    tokenContext="oauth2"
    timestampSkew=5000

    [jwtTokenConfig]
    issuer="{{issuer}}"
    audience="{{audience}}"
    certificateAlias="{{certificateAlias}}"


    [jwtConfig]
    header="X-JWT-Assertion"

    [caching]
    enabled=true
    tokenCache.expiryTime=900000
    tokenCache.capacity=10000
    tokenCache.evictionFactor=0.25

    [analytics]
    enable={{analyticsEnabled}}
    uploadingTimeSpanInMillis={{uploadingTimeSpanInMillis}}
    uploadingEndpoint="https://{{hostname}}:{{port}}/analytics/v1.0/usage/upload-file"
    rotatingPeriod={{rotatingPeriod}}
    task.uploadFiles={{rotatingPeriod}}
    username="{{analyticsUsername}}"
    password="{{analyticsPassword}}"

    [http2]
    enable=false

    [mutualSSLConfig]
    protocolName="TLS"
    protocolVersions="TLSv1.2,TLSv1.1"
    ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256  ,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256  ,TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,TLS_EMPTY_RENEGOTIATION_INFO_SCSV"
    sslVerifyClient="not_require"

    ["b7a.users"]
    ["b7a.users.{{basicUsername}}"]
    password="{{basicPassword}}"

    [validationConfig]
    enableRequestValidation = false
    enableResponseValidation = false
    absolutePathToSwagger = " "


    [throttlingConfig]
    enabledGlobalTMEventPublishing = {{enabledGlobalTMEventPublishing}}
    jmsConnectioninitialContextFactory = "bmbInitialContextFactory"
    jmsConnectionProviderUrl= "amqp://admin:admin@carbon/carbon?brokerlist='tcp://{{jmsConnectionProvider}}'"
    jmsConnectionUsername = ""
    jmsConnectionPassword = ""
    throttleEndpointUrl = "https://{{throttleEndpoint}}/endpoints"
    throttleEndpointbase64Header = "admin:admin"

    [tokenRevocationConfig]
      [tokenRevocationConfig.realtime]
        enableRealtimeMessageRetrieval = false
        jmsConnectionTopic = "tokenRevocation"
        jmsConnectioninitialContextFactory = "bmbInitialContextFactory"
        jmsConnectionProviderUrl= "amqp://admin:admin@carbon/carbon?brokerlist='tcp://localhost:5672'"
        jmsConnectionUsername = ""
        jmsConnectionPassword = ""
      [tokenRevocationConfig.persistent]
        enablePersistentStorageRetrieval = false
        useDefault = true
        hostname = "https://127.0.0.1:2379/v2/keys/jti/"
        username = "root"
        password = "root"

    [httpClients]
      verifyHostname={{verifyHostname}}
    
    [b7a.log]
      level="{{logLevel}}"