Hi everyone. I’ve been wondering if Koin scopes ar...
# koin
d
Hi everyone. I’ve been wondering if Koin scopes are an appropriate way to keep a tenant in context during the life of a request in a multi-tenant service I’m working on. I’ve been experimenting with intercepting the Ktor route, then setting the Tenant in a scope (similar to
module { scope("id") { Tenant() }}
. The tenant instance holds metadata about the tenant, stored in the database, which necessary for fulfilling the requested action. However, I’ve been thinking that creating new scope per request may not be the intended usage for the scope feature, and I might be better served by just pulling Tenant from the DB and passing it into the service object when I handle the request, outside of koin. Has anyone used Koin scopes in this sort of way before? (Really have enjoyed using Koin with Ktor btw).