Open
Description
Following on from the discourse conversation here.
When using the settings provider source, it currently isn't possible to assign a prefix to an environment variable name without also having the prefix in the internal setting name. We have written a patch and it seems straightforward enough to allow an optional prefix to be configured in the register_provider
block like so:
Application.register_provider(:settings, from: :dry_system) do
prefix { 'SOME_PREFIX_' }
settings do
setting :database_url, constructor: Types::String.constrained(filled: true)
end
I would like to submit a PR for this soon, if maintainers feel it would be helpful!
@solnic also mentioned that:
Having ability to have nested keys from env would be great too like STRIPE__API_KEY would be turned into settings.stripe.api_key.
I agree that would be a nice feature, so I would be happy to implement that too.
Activity