################################################################################################################
# The default configuration values for Vinyl.  All configuration values that we use and process in Vinyl
# MUST have a corresponding value in here in the event that the application is not configured, otherwise
# a ConfigurationMissing exception will be thrown by the typesafe config
################################################################################################################
vinyldns {

  # configured backend providers
  backend {
    # Use "default" when dns backend legacy = true
    # otherwise, use the id of one of the connections in any of your backends
    default-backend-id = "default"

    # this is where we can save additional backends
    backend-providers = [
      {
        class-name = "vinyldns.api.backend.dns.DnsBackendProviderLoader"
        settings = {
          legacy = false
          backends = [
            {
              id = "default"
              zone-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                primary-server = "127.0.0.1:19001"
              }
              transfer-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                primary-server = "127.0.0.1:19001"
              },
              tsig-usage = "always"
            },
            {
              id = "func-test-backend"
              zone-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                primary-server = "127.0.0.1:19001"
              }
              transfer-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                primary-server = "127.0.0.1:19001"
              },
              tsig-usage = "always"
            }
          ]
        }
      }
    ]
  }

  # if we should start up polling for change requests, set this to false for the inactive cluster
  processing-disabled = false

  max-zone-size = 60000 # number of records that can be in a zone

  queue {
    class-name = "vinyldns.sqs.queue.SqsMessageQueueProvider"

    messages-per-poll = 10
    polling-interval = 250.millis
    max-retries = 100 # Max retries for message on queue; currently only applies to MySqlMessageQueue

    settings {
      # AWS access key and secret.
      # access-key = "x"
      # secret-key = "x"

      # Regional endpoint to make your requests (eg. 'us-west-2', 'us-east-1', etc.). This is the region where your queue is housed.
      signing-region = "us-east-1"

      # Endpoint to access queue
      service-endpoint = "http://localhost:19003/"

      # Queue name. Should be used in conjunction with service endpoint, rather than using a queue url which is subject to change.
      queue-name = "vinyldns"
    }
  }

  # approved name servers that are allowable, default to our internal name servers for test
  approved-name-servers = [
    "172.17.42.1.",
    "ns1.parent.com."
  ]

  # approved zones, individual users, users in groups, record types and no.of.dots that are allowed for dotted hosts
  dotted-hosts = {
    # for local testing
    allowed-settings = [
      {
      # for wildcard zones. Settings will be applied to all matching zones
      zone = "*ent.com*."
      user-list = ["ok"]
      group-list = ["dummy-group"]
      record-types = ["CNAME"]
      dots-limit = 3
      },
      {
      # for wildcard zones. Settings will be applied to all matching zones
      zone = "dummy*."
      user-list = ["sharedZoneUser"]
      group-list = ["history-group1"]
      record-types = ["A"]
      dots-limit = 3
      }
    ]
  }

  # color should be green or blue, used in order to do blue/green deployment
  color = "green"

  # version of vinyldns
  base-version = "unset"
  version = ${vinyldns.base-version}

  # time users have to wait to resync a zone
  sync-delay = 600000

  # the host and port that the vinyldns service binds to
  rest {
    host = "127.0.0.1"
    port = 9000
  }
  # limits for batchchange routing, membership routing , recordset routing , zone routing
  api {
    limits {
      batchchange-routing-max-items-limit = 100
      membership-routing-default-max-items = 100
      membership-routing-max-items-limit = 1000
      membership-routing-max-groups-list-limit = 3000
      recordset-routing-default-max-items= 100
      zone-routing-default-max-items = 100
      zone-routing-max-items-limit = 100
    }
  }
  mysql {
    class-name = "vinyldns.mysql.repository.MySqlDataStoreProvider"

    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 = "vinyldns"
      driver = "org.mariadb.jdbc.Driver"
      migration-url = "jdbc:mariadb://localhost:19002/?user=root&password=pass"
      url = "jdbc:mariadb://localhost:19002/vinyldns?user=root&password=pass"
      user = "root"
      password = "pass"
      flyway-out-of-order = false
    }

    repositories {
      # override with any repos that are running in mysql
    }
  }

  notifiers = []

  email = {
    class-name = "vinyldns.api.notifier.email.EmailNotifierProvider"
    settings = {
      from = "VinylDNS <do-not-reply@vinyldns.io>"
    }
  }
 valid-email-config{
      email-domains = ["test.com","*dummy.com"]
      number-of-dots= 2
    }
  sns {
    class-name = "vinyldns.api.notifier.sns.SnsNotifierProvider"
    settings {
      topic-arn = "arn:aws:sns:us-east-1:000000000000:batchChanges"
      access-key = "test"
      secret-key = "test"
      service-endpoint = "http://127.0.0.1:19003"
      signing-region = "us-east-1"
    }
  }

  defaultZoneConnection {
    name = "vinyldns."
    name=  ${?DEFAULT_DNS_KEY_NAME}
    keyName = "vinyldns."
    keyName=  ${?DEFAULT_DNS_KEY_NAME}
    key = "nzisn+4G2ldMn0q1CV3vsg=="
    key = ${?DEFAULT_DNS_KEY_SECRET}
    primaryServer = "127.0.0.1:19001"
    primary-server = ${?DEFAULT_DNS_ADDRESS}
  }

  defaultTransferConnection {
    name = "vinyldns."
    name=  ${?DEFAULT_DNS_KEY_NAME}
    keyName = "vinyldns."
    keyName=  ${?DEFAULT_DNS_KEY_NAME}
    key = "nzisn+4G2ldMn0q1CV3vsg=="
    key = ${?DEFAULT_DNS_KEY_SECRET}
    primaryServer = "127.0.0.1:19001"
    primary-server = ${?DEFAULT_DNS_ADDRESS}
  }

  batch-change-limit = 1000

  metrics {
    memory {
      log-enabled = false
      log-seconds = 30
    }
  }

  scheduled-changes-enabled = false
  v6-discovery-nibble-boundaries {
    min = 5
    max = 20
  }

  # Global ACLs defaults to an empty list
  global-acl-rules = []

  health-check-timeout = 10000

  default-ttl = 7200

  validate-record-lookup-against-dns-backend = false

  use-recordset-cache = false
  use-recordset-cache = ${?USE_RECORDSET_CACHE}

  load-test-data = false
  load-test-data = ${?LOAD_TEST_DATA}

  # should be true while running locally or when we have only one api server/instance, for zone sync scheduler to work
  is-zone-sync-schedule-allowed = true
  # should be set to true only on a single server/instance else automated sync will be performed at every server/instance
  is-zone-sync-schedule-allowed = ${?IS_ZONE_SYNC_SCHEDULE_ALLOWED}
}
