apiVersion: v1
kind: ConfigMap
metadata:
  name: anchor-platform-sep-server-config
  namespace: anchor-platform-dev
data:
  # TODO: remove all secrets (ex: move to env vars, k8s secrets, vault, etc...)
  anchor-config.yaml: |
    stellar:
      anchor:
        # Configure the application from this file after it is loaded in memory
        # If `config` is in-memory, the yaml file contains all settings for the server.
        config: in-memory
        app-config:
          type: config-spring-property                # Activate [config-spring-property] module
          settings: app-config                        # The location of the configuration data
        data-access:
          type: data-spring-jdbc                      # Activate [config-spring-jdbc] module.
          settings: data-spring-jdbc-sqlite           # The location of the configuration data in this file.
        logging:
          type: logging-logback
          settings: logging-logback-settings

    #
    # Application settings
    #
    app-config:
      # general
      app:
        stellarNetworkPassphrase: Test SDF Network ; September 2015
        hostUrl: https://anchor-sep-server-dev.stellar.org
        languages: en
        horizonUrl: https://horizon-testnet.stellar.org
        assets: assets-test.json
        jwtSecretKey: secret
    
      # sep-1
      sep1:
        enabled: true
        stellarFile: file:/config/stellar-wks.toml

      # sep-10
      sep10:
        enabled: true
        homeDomain: anchor-sep-server-dev.stellar.org
        clientAttributionRequired: false
        clientAttributionAllowList: lobstr.co,preview.lobstr.co # use this if we want to white list
        # clientAttributionDenyList: # use this if we want to black list.
        authTimeout: 900
        jwtTimeout: 86400
        signingSeed: SBTBRGMPWNLXOZQQQXXZRJKCZPYTAZT5FC4VEAECF2HOBCONTSH4EXKS

      # sep-12
      sep12:
        enabled: true
        customerIntegrationEndpoint: https://anchor-reference-server-dev.stellar.org
    
      # sep-24
      sep24:
        enabled: true
        interactiveJwtExpiration: 3600
        interactiveUrl: https://anchor-reference-server-dev.stellar.org/sep24/interactive

      # sep-31
      sep31:
        enabled: true
        feeIntegrationEndPoint: https://anchor-reference-server-dev.stellar.org
        #
        # paymentType: used to determine how amount_in is calculated from amount in the POST /transaction call
        # Possible values: STRICT_SEND or STRICT_RECEIVE. default=STRICT_SEND
        #     STRICT_SEND: amount_in = amount
        #     STRICT_RECEIVE: amount_in = amount + fee
        paymentType: STRICT_SEND
        #
        # depositInfoGeneratorType: used to choose how the SEP-31 deposit information will be generated, which includes the
        # deposit address, memo and memo type.
        # Possible values:
        #     self: the memo and memo type are generated in the local code, and the distribution account is used for the deposit address.
        #     circle: the memo and memo type are generated through Circle API, as well as the deposit address.
        depositInfoGeneratorType: self # self or circle

      # sep-38
      sep38:
        enabled: true
        quoteIntegrationEndPoint: https://anchor-reference-server-dev.stellar.org

      circle:
        circleUrl: https://api-sandbox.circle.com
        apiKey: secret # circle API key

      payment-gateway:
        #
        # Payment Circle configurations
        #
        circle:
          name: "circle"
          enabled: true

        #
        # Payment Stellar configurations
        #
        stellar:
          enabled: false
          name: "stellar"
          horizonUrl: https://horizon-testnet.stellar.org
          secretKey: secret # stellar account secret key

      circle-payment-observer:
        enabled: true
        horizonUrl: https://horizon-testnet.stellar.org
        stellarNetwork: TESTNET # TESTNET or PUBLIC
        trackedWallet: all

      event:
        # If enabled, publish Events to a queue (publisherType)
        # publisherType - the type of queue to use for event publishing
        enabled: true
        publisherType: kafka

      kafka.publisher:
        # kafkaBootstrapServer - the Kafka server used to bootstrap setup
        # If useSingleQueue, all events are published to a single queue
        #   (specified in eventTypeToQueue.all)
        # eventTypeToQueue - a map of the event type to the queue name messages are published to
        bootstrapServer: anchor-platform-kafka:9092
        useSingleQueue: false
        eventTypeToQueue:
          all: dev_ap_event_single_queue
          quoteCreated: dev_ap_event_quote_created
          transactionCreated: dev_ap_event_transaction_created
          transactionStatusChanged: dev_ap_event_transaction_status_changed
          transactionError: dev_ap_event_transaction_error

    #
    # Spring Data JDBC settings
    #
    data-spring-jdbc-sqlite:
      spring.jpa.database-platform: org.stellar.anchor.platform.sqlite.SQLiteDialect
      spring.jpa.hibernate.ddl-auto: update
      spring.jpa.generate-ddl: true
      spring.jpa.hibernate.show_sql: false
      spring.datasource.url: jdbc:sqlite:anchor-proxy.db
      spring.datasource.driver-class-name: org.sqlite.JDBC
      spring.datasource.username: admin
      spring.datasource.password: admin
      spring.mvc.converters.preferred-json-mapper: gson
      spring.liquibase.enabled: false

    data-spring-jdbc-h2:
      spring.datasource.url: jdbc:h2:mem:test
      spring.jpa.properties.hibernate.dialect: org.hibernate.dialect.H2Dialect
      spring.liquibase.enabled: false

    #
    # Spring framework configurations
    #
    spring:
      logging:
        level:
          root: INFO
          org.springframework: INFO
          org.springframework.web.filter: INFO
          org.stellar: INFO
      mvc:
        async.request-timeout: 6000

  stellar-wks.toml: |
    ACCOUNTS = ["GDZCLP2PHTWYQ3BWZMC5D4ZUJX5NU4S7YZHC5EBFAFKL6UJUQ5RKDGSY"]
    VERSION = "0.1.0"
    NETWORK_PASSPHRASE = "Test SDF Network ; September 2015"
    SIGNING_KEY = "GDZCLP2PHTWYQ3BWZMC5D4ZUJX5NU4S7YZHC5EBFAFKL6UJUQ5RKDGSY"

    TRANSFER_SERVER = "https://anchor-sep-server-dev.stellar.org/sep6"
    TRANSFER_SERVER_SEP0024 = "https://anchor-sep-server-dev.stellar.org/sep24"
    WEB_AUTH_ENDPOINT = "https://anchor-sep-server-dev.stellar.org/auth"
    KYC_SERVER = "https://anchor-sep-server-dev.stellar.org/sep12"
    DIRECT_PAYMENT_SERVER = "https://anchor-sep-server-dev.stellar.org/sep31"
    ANCHOR_QUOTE_SERVER = "https://anchor-sep-server-dev.stellar.org/sep38"

    [[CURRENCIES]]
    code = "USDC"
    issuer = "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
    status = "test"
    is_asset_anchored = true
    anchor_asset_type = "fiat"
    desc = "A test USDC issued by Circle."

    [DOCUMENTATION]
    ORG_NAME = "Stellar Development Foundation"
    ORG_URL = "https://www.stellar.org"
    ORG_DESCRIPTION = "Stellar is an open network for storing and moving money."
    ORG_LOGO="https://assets-global.website-files.com/5deac75ecad2173c2ccccbc7/5dec8960504967fd31147f62_Stellar_lockup_black_RGB.svg"
    ORG_SUPPORT_EMAIL="jamie@stellar.org"
