You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromdependency_injectorimportcontainers, providersclassContainer(containers.DeclarativeContainer):
# obtain `environment` as a passed in parameterenvironment=providers.Dependency()
# utilise the provided `environment`service=providers.Factory(Service, env=environment.provided)
fromdependency_injector.wiringimportProvide, inject@injectdefstart(service: Service=Provide['service']) ->None:
...
if__name__=="__main__":
# example of passing a param into our containercontainer=Container(environment='DEBUG')
container.wire(modules=[__name__])
start()
Given the above example, with a dependency provided as environment I would like to know if something like this exists within the dependency_injector package, I had a look at the documentation and couldn't really figure out a way to achieve this, and this is as far as I got which doesn't work
The text was updated successfully, but these errors were encountered:
Given the above example, with a dependency provided as
environment
I would like to know if something like this exists within thedependency_injector
package, I had a look at the documentation and couldn't really figure out a way to achieve this, and this is as far as I got which doesn't workThe text was updated successfully, but these errors were encountered: