mysql {
  class-name = "vinyldns.mysql.repository.MySqlDataStoreProvider"
  endpoint = "localhost:19002"
  endpoint = ${?MYSQL_ENDPOINT}

  settings {
    # JDBC Settings, these are all values in scalikejdbc-config, not our own
    # these must be overridden to use MYSQL for production use
    # assumes a docker or mysql instance running locally
    name = "vinyldns2"
    driver = "org.mariadb.jdbc.Driver"
    migration-url = "jdbc:mariadb://"${mysql.endpoint}"/"
    url = "jdbc:mariadb://"${mysql.endpoint}"/vinyldns2"
    user = "root"
    password = "pass"
    flyway-out-of-order = false

    # see https://github.com/brettwooldridge/HikariCP
    connection-timeout-millis = 1000
    idle-timeout = 10000
    max-lifetime = 30000
    maximum-pool-size = 5
    minimum-idle = 0

    my-sql-properties = {
      cachePrepStmts=true
      prepStmtCacheSize=250
      prepStmtCacheSqlLimit=2048
      rewriteBatchedStatements=true
    }
  }

  repositories {
    batch-change {}
    zone {}
    record-set {}
    record-set-cache {}
  }
}

queue {
  class-name = "vinyldns.mysql.queue.MySqlMessageQueueProvider"
  polling-interval = 250.millis
  messages-per-poll = 10
  max-retries = 100 # Max retries for message on queue

  settings = {
    name = "vinyldns2"
    driver = "org.mariadb.jdbc.Driver"
    migration-url = "jdbc:mariadb://"${mysql.endpoint}"/?user=root&password=pass"
    url = "jdbc:mariadb://"${mysql.endpoint}"/vinyldns2?user=root&password=pass"
    user = "root"
    password = "pass"
    flyway-out-of-order = false

    # see https://github.com/brettwooldridge/HikariCP
    connection-timeout-millis = 1000
    idle-timeout = 10000
    max-lifetime = 30000
    maximum-pool-size = 5
    minimum-idle = 0

    my-sql-properties = {
      cachePrepStmts=true
      prepStmtCacheSize=250
      prepStmtCacheSqlLimit=2048
      rewriteBatchedStatements=true
    }
  }
}
