Rig.Config (Reactive Interaction Gateway v3.0.0-alpha.2) View Source
Rig module configuration that provides settings/0
.
There are two ways to use this module
Specify a list of expected keys
defmodule Rig.MyExample do
use Rig.Config, [:some_key, :other_key]
end
Rig.Config
expects a config entry similar to this:
config :rig, Rig.MyExample,
some_key: ...,
other_key: ...
If one of the specified keys is not found, an error is thrown at compile time.
Otherwise, Rig.MyExample
gets a config/0
function that returns the
configuration converted to a map.
If there are other keys present, they'll be added to that map as well.
Specify :custom_validation
instead
defmodule Rig.MyExample do
use Rig.Config, :custom_validation
defp validate_config!(config) do
...
end
end
If you use :custom_validation, you should deal with the raw keyword list
by implementing validate_config!/1
in the module.