Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi tenant db hosts #41

Merged
merged 3 commits into from
Jun 28, 2024

Conversation

RamyHakam
Copy link
Owner

@RamyHakam RamyHakam commented Jun 4, 2024

In this PR we will support Multi-tenant db hosts, which means that for each tenant you can have a completely different host and port,
Some notes regarding this feature

  1. All tenant DBs should have the same Driver type, Cuz For now the tenant Sechma is shared between all tenants
  2. If your tenants host on localhost but with different ports, it is better to use IP rather than localhost in your host
  3. In docker you should use IP rather than localhost
  4. You can use docker.host.internal as your host in your docker env
    But remember to add it as an extra host in your compose file

@RamyHakam RamyHakam linked an issue Jun 4, 2024 that may be closed by this pull request
@RamyHakam RamyHakam self-assigned this Jun 4, 2024
@RamyHakam RamyHakam added the enhancement New feature or request label Jun 4, 2024
@RamyHakam RamyHakam merged commit 6460290 into master Jun 28, 2024
1 check passed
@rodmarzavala
Copy link

Hello @RamyHakam,

First, thank you for your incredible work on this bundle. It has been incredibly useful and greatly simplifies multi-tenancy in Symfony applications.

However, I am experiencing an issue related to the recent merge. Specifically, the changes require hardcoding db_username, db_password, and even pdo_driver in my TenantConfig class.

For more details, see TenantDbConfigTrait.php.

Would it be possible to revert from:

$tenantConnection = DriverManager::getConnection($dsnParser->parse($dbConfiguration->getDsnUrl()));

to

$tenantConnection = DriverManager::getConnection($dsnParser->parse($this->dbCredentials['db_url']));

in DbService.php?

This change would allow for more flexibility in managing database credentials and avoid hardcoding sensitive information in the TenantConfig class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Multi tenancy with multi database
2 participants