---
apiVersion: v1
kind: ConfigMap
metadata:
  name: central-ledger-config
  labels:
      app: central-ledger
data:
  ## The port the API server will run on. Default: 3000
  server.port: "3000"
  ## The URI that will be used to create and validate links to resources on the central ledger.
  server.host: "central-ledger"
  ## The port the Admin server will run on. Default: 3001
  admin.port: "3001"
  ## default config file
  default.json: |
    {
      "PORT": 3000,
      "ADMIN_PORT": 3001,
      "HOSTNAME": "http://central-ledger",
      "ENABLE_TOKEN_AUTH": false,
      "ENABLE_BASIC_AUTH": false,
      "LEDGER_ACCOUNT_NAME": "LedgerName",
      "LEDGER_ACCOUNT_PASSWORD": "LedgerPassword",
      "AMOUNT": {
          "PRECISION": 10,
          "SCALE": 2
      },
      "SIDECAR": {
          "DISABLED": false,
          "HOST": "forensic-logging-sidecar",
          "PORT": 5678,
          "CONNECT_TIMEOUT": 45000,
          "RECONNECT_INTERVAL": 5000
      }
    }
  ## default knexfile config
  knexfile.js: |
    'use strict'

    const migrationsDirectory = '/opt/central-ledger/migrations'
    const Config = require('/opt/central-ledger/src/lib/config')
    module.exports = {
      client: 'pg',
      connection: Config.DATABASE_URI,
      migrations: {
        directory: migrationsDirectory,
        tableName: 'migrations',
        stub: `${migrationsDirectory}/migration.template`
      }
    }
