vinyldns {
  base-version = "0.0.0-local-dev"
  version = ${vinyldns.base-version} # default to the base version if not overridden
  version = ${?VINYLDNS_VERSION} # override the base version via env var

  # How often to any particular zone can be synchronized in milliseconds
  sync-delay = 10000
  sync-delay = ${?SYNC_DELAY}

  # If we should start up polling for change requests, set this to false for the inactive cluster
  processing-disabled = false
  processing-disabled = ${?PROCESSING_DISABLED}

  # Number of records that can be in a zone
  max-zone-size = 60000
  max-zone-size = ${?MAX_ZONE_SIZE}

  # Types of unowned records that users can access in shared zones
  shared-approved-types = ["A", "AAAA", "CNAME", "PTR", "TXT"]

  # Batch change settings
  batch-change-limit = 1000
  batch-change-limit = ${?BATCH_CHANGE_LIMIT}
  manual-batch-review-enabled = true
  manual-batch-review-enabled = ${?MANUAL_BATCH_REVIEW_ENABLED}
  scheduled-changes-enabled = true
  scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
  multi-record-batch-change-enabled = true
  multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}

  # Server settings
  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}

  # 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-name = ${?DEFAULT_DNS_KEY_NAME}
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                key = ${?DEFAULT_DNS_KEY_SECRET}
                primary-server = "127.0.0.1:19001"
                primary-server = ${?DEFAULT_DNS_ADDRESS}
              }
              transfer-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key-name = ${?DEFAULT_DNS_KEY_NAME}
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                key = ${?DEFAULT_DNS_KEY_SECRET}
                primary-server = "127.0.0.1:19001"
                primary-server = ${?DEFAULT_DNS_ADDRESS}
              },
              tsig-usage = "always"
            },
            {
              id = "func-test-backend"
              zone-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key-name = ${?DEFAULT_DNS_KEY_NAME}
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                key = ${?DEFAULT_DNS_KEY_SECRET}
                primary-server = "127.0.0.1:19001"
                primary-server = ${?DEFAULT_DNS_ADDRESS}
              }
              transfer-connection = {
                name = "vinyldns."
                key-name = "vinyldns."
                key-name = ${?DEFAULT_DNS_KEY_NAME}
                key = "nzisn+4G2ldMn0q1CV3vsg=="
                key = ${?DEFAULT_DNS_KEY_SECRET}
                primary-server = "127.0.0.1:19001"
                primary-server = ${?DEFAULT_DNS_ADDRESS}
              },
              tsig-usage = "always"
            }
          ]
        }
      }
    ]
  }


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

    messages-per-poll = 10
    polling-interval = 250.millis

    settings {
      # AWS access key and secret.
      access-key = "test"
      access-key = ${?AWS_ACCESS_KEY}
      secret-key = "test"
      secret-key = ${?AWS_SECRET_ACCESS_KEY}

      # 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"
      signing-region = ${?SQS_REGION}

      # Endpoint to access queue
      service-endpoint = "http://localhost:19003/"
      service-endpoint = ${?SQS_SERVICE_ENDPOINT}

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

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

  rest {
    host = "0.0.0.0"
    port = 9000
    port=${?API_SERVICE_PORT}
  }

  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
    }
  }

  approved-name-servers = [
    "172.17.42.1.",
    "ns1.parent.com."
    "ns1.parent.com1."
    "ns1.parent.com2."
    "ns1.parent.com3."
    "ns1.parent.com4."
  ]

  # approved zones, individual users, users in groups, record types and no.of.dots that are allowed for dotted hosts
  dotted-hosts = {
    allowed-settings = [
      {
      zone = "zonenamehere."
      user-list = []
      group-list = []
      record-types = []
      dots-limit = 0
      }
    ]
  }

  # Note: This MUST match the Portal or strange errors will ensue, NoOpCrypto should not be used for production
  crypto {
    type = "vinyldns.core.crypto.NoOpCrypto"
    type = ${?CRYPTO_TYPE}
    secret = ${?CRYPTO_SECRET}
  }

  data-stores = ["mysql"]
  mysql {
    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"
      name = ${?DATABASE_NAME}
      driver = "org.mariadb.jdbc.Driver"
      driver = ${?JDBC_DRIVER}
      migration-url = "jdbc:mariadb://localhost:19002/?user=root&password=pass&socketTimeout=20000"
      migration-url = ${?JDBC_MIGRATION_URL}
      url = "jdbc:mariadb://localhost:19002/vinyldns?user=root&password=pass&socketTimeout=20000"
      url = ${?JDBC_URL}
      user = "root"
      user = ${?JDBC_USER}
      password = "pass"
      password = ${?JDBC_PASSWORD}
      flyway-out-of-order = false
      flyway-out-of-order = ${?FLYWAY_OUT_OF_ORDER}

      max-lifetime = 300000
      connection-timeout-millis = 30000
      idle-timeout = 150000
      maximum-pool-size = 20
      minimum-idle = 5
    }

    # TODO: Remove the need for these useless configuration blocks
    repositories {
      zone {
      }
      batch-change {
      }
      user {
      }
      record-set {
      }
      record-set-cache {
      }
      zone-change {
      }
      record-change {
      }
      group {
      }
      group-change {
      }
      membership {
      }
    }
  }

  backends = []

  # FQDNs / IPs that cannot be modified via VinylDNS
  # regex-list used for all record types except PTR
  # ip-list used exclusively for PTR records
  high-value-domains = {
    regex-list = [
      "high-value-domain.*" # for testing
    ]
    ip-list = [
      # using reverse zones in the vinyldns/bind9 docker image for testing
      "192.0.2.252",
      "192.0.2.253",
      "fd69:27cc:fe91:0:0:0:0:ffff",
      "fd69:27cc:fe91:0:0:0:ffff:0"
    ]
  }

  # FQDNs / IPs / zone names that require manual review upon submission in batch change interface
  # domain-list used for all record types except PTR
  # ip-list used exclusively for PTR records
  manual-review-domains = {
    domain-list = [
      "needs-review.*"
    ]
    ip-list = [
      "192.0.1.254",
      "192.0.1.255",
      "192.0.2.254",
      "192.0.2.255",
      "192.0.3.254",
      "192.0.3.255",
      "192.0.4.254",
      "192.0.4.255",
      "fd69:27cc:fe91:0:0:0:ffff:1",
      "fd69:27cc:fe91:0:0:0:ffff:2",
      "fd69:27cc:fe92:0:0:0:ffff:1",
      "fd69:27cc:fe92:0:0:0:ffff:2",
      "fd69:27cc:fe93:0:0:0:ffff:1",
      "fd69:27cc:fe93:0:0:0:ffff:2",
      "fd69:27cc:fe94:0:0:0:ffff:1",
      "fd69:27cc:fe94:0:0:0:ffff:2"
    ]
    zone-name-list = [
      "zone.requires.review."
      "zone.requires.review1."
      "zone.requires.review2."
      "zone.requires.review3."
      "zone.requires.review4."
    ]
  }

  # FQDNs / IPs that cannot be modified via VinylDNS
  # regex-list used for all record types except PTR
  # ip-list used exclusively for PTR records
  high-value-domains = {
    regex-list = [
      "high-value-domain.*" # for testing
    ]
    ip-list = [
      # using reverse zones in the vinyldns/bind9 docker image for testing
      "192.0.1.252",
      "192.0.1.253",
      "192.0.2.252",
      "192.0.2.253",
      "192.0.3.252",
      "192.0.3.253",
      "192.0.4.252",
      "192.0.4.253",
      "fd69:27cc:fe91:0:0:0:0:ffff",
      "fd69:27cc:fe91:0:0:0:ffff:0",
      "fd69:27cc:fe92:0:0:0:0:ffff",
      "fd69:27cc:fe92:0:0:0:ffff:0",
      "fd69:27cc:fe93:0:0:0:0:ffff",
      "fd69:27cc:fe93:0:0:0:ffff:0",
      "fd69:27cc:fe94:0:0:0:0:ffff",
      "fd69:27cc:fe94:0:0:0:ffff:0"
    ]
  }

  global-acl-rules = [
    {
      group-ids: ["global-acl-group-id"],
      fqdn-regex-list: [".*shared[0-9]{1}."]
    },
    {
      group-ids: ["another-global-acl-group"],
      fqdn-regex-list: [".*ok[0-9]{1}."]
    }
  ]
}

akka {
  loglevel = "INFO"
  loggers = ["akka.event.slf4j.Slf4jLogger"]
  logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
  logger-startup-timeout = 30s

  actor {
    provider = "akka.actor.LocalActorRefProvider"
  }
}

akka.http {
  server {
    # The time period within which the TCP binding process must be completed.
    # Set to `infinite` to disable.
    bind-timeout = 5s

    # A default request timeout is applied globally to all routes and can be configured using the
    # akka.http.server.request-timeout setting (which defaults to 20 seconds).
    # request-timeout = 60s

    # Show verbose error messages back to the client
    verbose-error-messages = on
  }

  parsing {
    # Don't complain about the / in the AWS SigV4 auth header
    ignore-illegal-header-for = ["authorization"]
  }
}

# You can provide configuration overrides via local.conf if you don't want to replace everything in
# this configuration file
include "local.conf"
