Closed AdamJessop closed 2 years ago
Hi @AdamJessop thanks for writing in. I didn't quite catch what is it that you are looking for. But this library actually extract the tenantId from the request object. And that parameter on which you are sending your tenantId can be customised. Please refer to the readme section for the configuration.
Hi @sandeepsuvit
I actually found a token that does exactly what I am looking for: TENANT_CONTEXT
I basically wanted to create a provider for my config, which is from a core DB. EG:
{
provide: 'TENANT_CONFIG',
useFactory: async (tenantId: string, tenants: Model<DBTenant>) => {
return tenants.findOne({ id: tenantId });
},
inject: [TENANT_CONTEXT, getModelToken(TENANT_SCHEMA)],
scope: Scope.REQUEST,
},
it would be great if there was a provider available to get the tenantId from the current request.
I have a use case in that my tenants are all configured in a central database but I want to load their configurations based on their ID.
either by having an injection token of TENANT_ID or a utility getTenantId() for example.
Is this somehow possible already?