SaltDnsWeb.Plugs.MetricsAuth (Salt v1.0.0)

Protects /metrics with a bearer token.

config :salt_dns, SaltDnsWeb.Metrics, token: "..."   # SALT_DNS_METRICS_TOKEN

Without a configured token the endpoint does not exist (404): metrics are off unless an operator turns them on. With one, a missing or wrong token is 401 and the comparison is constant-time. The token is never logged (SaltDns.LogFormatter scrubs it).

Summary

Functions

The configured token, or nil when metrics are off.

Functions

token()

@spec token() :: String.t() | nil

The configured token, or nil when metrics are off.