SaltDns.Apex (Salt v1.0.0)

The apex names of every zone Salt DNS serves: the SOA's MNAME and RNAME and the NS set. One source of truth, read by the Knot writer (SaltDns.Knot.Sync.settings/0) and by the RFC 2136 listener (SaltDns.Listener.Snapshot).

Configuration, config :salt_dns, SaltDns.Apex, ns: [..], mname: .., rname: ... Production builds it from the environment in config/runtime.exs with from_env/1: SALT_DNS_NAMESERVERS (the default for the NS set and for the MNAME's first name), SALT_DNS_NS, SALT_DNS_SOA_MNAME and SALT_DNS_SOA_RNAME (required). There is no default: a missing value is an error when the configuration is read (and validate!/0 when the application starts), never a placeholder in somebody's zone. config/dev.exs and config/test.exs set .invalid names.

Summary

Functions

Builds the configuration from environment variables (a map of name to value, normally System.get_env/0). Raises ArgumentError naming the missing variable. SALT_DNS_NS defaults to the nameservers, SALT_DNS_SOA_MNAME to the first of them.

The same names as the listener's mname:, rname: and ns: options.

The settings the Knot writer uses. Raises ArgumentError when the configuration is missing or incomplete.

Raises ArgumentError unless the apex names are configured; returns :ok.

Types

t()

@type t() :: %{
  nameservers: [String.t(), ...],
  mname: String.t(),
  hostmaster: String.t()
}

Functions

from_env(env)

@spec from_env(%{optional(String.t()) => String.t()}) :: keyword()

Builds the configuration from environment variables (a map of name to value, normally System.get_env/0). Raises ArgumentError naming the missing variable. SALT_DNS_NS defaults to the nameservers, SALT_DNS_SOA_MNAME to the first of them.

listener_opts()

@spec listener_opts() :: keyword()

The same names as the listener's mname:, rname: and ns: options.

settings()

@spec settings() :: t()

The settings the Knot writer uses. Raises ArgumentError when the configuration is missing or incomplete.

validate!()

@spec validate!() :: :ok

Raises ArgumentError unless the apex names are configured; returns :ok.