Providers

The appsettings2.providers module contains a set of built-in ConfigurationProvider implementations for populating configuration data from:

Configuration Sources

All of the built-in providers can be used together without conflict.

Custom Configration Providers

Custom Configuration Providers can be implemented by subclassing ConfigurationProvider and implementing its only method populate_configuration():

class MyCustomConfigurationProvider(ConfigurationProvider):

    def populate_configuration(self, configuration:Configuration) -> None:
        configuration.set('Example', [ 1, 2, 3 ])

Essentially, you read your configuration source and write the configuration data into the specified Configuration object using set(). Much of the complexity in dealing with hierarchy and type coercion is encapsulated within the impl of Configuration. As a result, most providers are less than 20 lines of functional code.

Configuration Providers.