# `Prometheus.Config`
[🔗](https://github.com/prometheus-erl/prometheus.ex/blob/v5.1.0/lib/prometheus/config.ex#L1)

Configuration templates for custom collectors/exporters.

When `use`ed, generates accessor for each configuration option:

    iex(4)> defmodule MyInstrumenter do
    ...(4)>   use Prometheus.Config, [:required_option,
    ...(4)>                           registry: :default]
    ...(4)> end
    iex(5)> MyInstrumenter.Config.registry(MyInstrumenter)
    :default
    iex(6)> MyInstrumenter.Config.required_option!(MyInstrumenter)
    ** (Prometheus.Config.KeyNotFoundError) mandatory option :required_option not found in PrometheusTest.MyInstrumenter instrumenter/collector config
    iex(7)> Application.put_env(:prometheus, MyInstrumenter,
    ...(7)>                     [required_option: "Hello world!"])
    :ok
    iex(8)> MyInstrumenter.Config.required_option!(MyInstrumenter)
    "Hello world!"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
