Provider Manager¶
Each instance of a ConfigurationRegistry
has a
ProviderManager
as its
providers
attribute. The
manager keeps track of the providers that the registry will use to resolve its final
configuration values.
To add a provider, call the register()
method of the manager, passing in an object that implements
ConfigProviderBase
.
Registering a provider does two things:
Adds the provider instance as an attribute of the manager, named after the provider’s
provider_name
.Appends the the
provider_name
to the manager’sordering
attribute
To remove a provider, simply call deregister()
with the provider_name
, and the reverse process will be performed.
Merge Order¶
When assembling the final configuration dictionary, the manager’s
ordering
property
determines the order in which providers are merged. By default the most recently
registered provider has the highest precedence.
You can update the ordering
attribute to change the order in which provider dictionaries are merged (just
like any other Python list).