Closed umer2001 closed 2 years ago
Hey there, you can have a look at shahed tutorial on medusa blog about marketplace. It is using that approach which is the most used. You can find a link to the example repo in the resources part of the doc
Yeah I had the same thing in my mind as well but before that, I would like to test the behavior of multi-tenant 1 & I followed the tutorial step by step like
npx medex init
multiTenancy
property to medusa-config.js
TenantModule
into main.ts
and passed into load function arraynpx medex m -r -t <tenant-code>
resulys in:
No migrations are pending
[MEDEX-CLI] - 10/1/2022, 12:05:26 AM [Migrate command] Run migrations has been applied on database connection default
my multiTenancy object looks like this:
multiTenancy: {
enable: true,
tenant_code_resolver: (req) => req.body.tenant_id,
tenants: [
{
code: "t1",
database_config: {
database_type: "sqlite",
database_database: "./medusa-db-t1.sql",
database_extra: {},
},
},
],
}
Can you help me diagnose the problem?
It is actually an experimental module. Medusa does not allow custom properties in the config to be stored and for now it is in pause. It will act more as an example of what you can to to customise your architecture and i suggest that you create your own by maybe taking some inspiration of it ☺️ wdyt?
I have an Idea, I know it's not too professional but maybe we can pass the config as a JSON string to an environmental variable
OR make an optional parameter extenderConfig
in Medusa class constructor.
what do you think?
The env variable that you parse then would be doable. I could suggest that you export a const somewhere that you service can consume, it could also be a possibility, of course the database url would always have to be in the env. you could also imagine to have an external source which provides you with the config and that you can call from the service, which would also allow to not restart your instance each time you need to add a tenant 😀
Hi @umer2001 are you still interested to work on this Multi tenant Architecture, i am open for collaboration,
Thanks
Multi-tenant 2 I am interested in working on Multi-tenant 2 which is mentioned in this image.
Can anyone guide me on where to start?