Skip to content

Type casting in dependency_injector.providers.Configuration.from_env #533

Open
@gtors

Description

@gtors

It would be useful to be able to cast env variables to a specific type, for example:

def setup_config(config: Configuration):
    config.foo.from_env("VAR_FOO", cast=int, default=1)
    config.bar.from_env("VAR_BAR", cast=bool, default=True)

Inspired by https://www.starlette.io/config/ and https://github.com/sloria/environs

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions