#Is it possible to "extract" a bound service and bind to other services?

1 messages · Page 1 of 1 (latest)

thorny wren
#

Suppose I have

backend_service = backend_container.with_service_binding("db", db_service).as_service()

Can I reference the db_service from backend_service and connect it to another service too?

integration_container = (container
 .with_service_binding("backend", backend_service)
 .with_service_binding("db", backend_service.db_service)
)

Otherwise I will have to separately pass the db_service making the code a little messier.

Already, I find networking very messy. Instead of passing around services individually, I think I ought to use a service registry that contains every service. Do you use this pattern?

frigid lion