Config.load_and_set_settings is the most convenient interface for initializing the Settings object with a bunch of configuration sources. However, one problem is that it only allows paths to YAML files. This means that if the user wants to use an explicit Config::Sources::HashSource or a Config::Sources::EnvSource such as for AWS Secrets Manager, they have to call add_source! and reload! separately.
This is especially cumbersome if the user is using a validation contract and the settings aren't yet valid until adding the non-YAML sources. It's possible to work around this problem by setting the validation_contactafter adding all sources:
This change makes this possible. There are some breaking changes in a few edge cases, but I expect that most applications will be able to upgrade without modification.
Config.load_and_set_settings
is the most convenient interface for initializing theSettings
object with a bunch of configuration sources. However, one problem is that it only allows paths to YAML files. This means that if the user wants to use an explicitConfig::Sources::HashSource
or aConfig::Sources::EnvSource
such as for AWS Secrets Manager, they have to calladd_source!
andreload!
separately.This is especially cumbersome if the user is using a validation contract and the settings aren't yet valid until adding the non-YAML sources. It's possible to work around this problem by setting the
validation_contact
after adding all sources:That's clunky. It'd be easier if the user could just specify the non-YAML sources up front.
This change makes this possible. There are some breaking changes in a few edge cases, but I expect that most applications will be able to upgrade without modification.