confy v0.3.0 Confy.Options View Source
This struct represents the options you can pass
to a call of Confy.load/2
(or YourModule.load/1
).
Metaconfiguration
Besides making it nice and explicit to have the options listed here,
Confy.Options
has itself been defined using Confy.defconfig/2
,
which means that it (and thus what default options are passed on to to other Confy configurations)
can be configured in the same way.
Configuration structure documentation:
This configuration was made using the Confy
library.
It contains the following fields:
sources
A list of structures that implement the Confy.Provider
protocol, which will be used to fetch configuration from.
Later entries in the list take precedence over earlier entries.
Defaults always have the lowest precedence, and :explicit_values
always have the highest precedence.
Validated/parsed by calling &Confy.Options.list_of_sources/1
.
Defaults to []
.
explicit_values
A list or map (or other enumerable) representing explicit values that are to be used instead of what can be found in the implicit sources stack.
Validated/parsed by calling &Confy.Parsers.term/1
.
Defaults to []
.
missing_fields_error
The error to be raised if a missing field which is required has been encountered.
Validated/parsed by calling &Confy.Parsers.term/1
.
Defaults to Confy.MissingRequiredFieldsError
.
parsing_error
The error to be raised if a field value could not properly be parsed.
Validated/parsed by calling &Confy.Parsers.term/1
.
Defaults to Confy.ParsingError
.
explain
When set to true
, rather than returning the config struct,
a map is returned with every field-key containing a list of consecutive found values.
This is useful for debugging.
Validated/parsed by calling &Confy.Parsers.boolean/1
.
Defaults to false
.
Metaconfiguration Gotcha's
Confy will only be able to find a source after it knows it exists. This means that it is impossible to define a different set of sources inside an external source.
For this special case, Confy will look at the current process' Process dictionary, falling back to the Application environment (also known as the Mix environment), and finally falling back to an empty list of sources (its default).
So, from lowest to highest precedence, option values are loaded in this order:
- Confy.Options default
- Application Environment
:confy
- Process Dictionary
:confy
field - Options passed to
Comfy.defconfig
- Options passed to
YourModule.load
Requiring Confy to be configured in such a general way seems highly unlikely. If the current approach does turn out to not be good enough for your use-case, please open an issue on Confy's issue tracker.
Link to this section Summary
Functions
Loads, parses, and normalizes the configuration of Confy.Options
, based on the current source settings, returning the result as a struct.
Loads, parses and normalizes the configuration of Confy.Options
, using the provided explicit_values
(and falling back to values configured elsewhere)
Link to this section Functions
list_of_sources(sources) View Source
load(options \\ []) View Source
Loads, parses, and normalizes the configuration of Confy.Options
, based on the current source settings, returning the result as a struct.
For more information about the options this function supports, see
Confy.load/2
and Confy.Options
load_explicit(explicit_values, options \\ []) View Source
Loads, parses and normalizes the configuration of Confy.Options
, using the provided explicit_values
(and falling back to values configured elsewhere)
For more information about the options this function supports, see
Confy.load_explicit/3
and Confy.Options