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

Add support for tenancy routing via custom header #145

Open
VaZark opened this issue May 23, 2023 · 4 comments
Open

Add support for tenancy routing via custom header #145

VaZark opened this issue May 23, 2023 · 4 comments

Comments

@VaZark
Copy link

VaZark commented May 23, 2023

Being able to define a custom header and using it for tenancy routing would make it a straightforward experience when django is used exclusively as a api backend.

@lorinkoz
Copy link
Owner

The idea makes sense. Not so sure about providing this functionality as part of this package or rather encourage local implementation where required. Any ideas how we could make this generic enough so as to add it to pgschemas?

@VaZark
Copy link
Author

VaZark commented Aug 11, 2023

This is best added in a separate, optional middleware. I check if the URL is the API endpoint and then look for the header key. If it isn't the API endpoint, i just forward it to the next middleware. The current one has to be updated to check if the tenant has already been set, if yes -> forward it; else run the std logic

@lorinkoz
Copy link
Owner

@VaZark Would you like to provide a PR adapted from your code? We could then work together on making the modifications required to integrate into this repo.

@lorinkoz
Copy link
Owner

Actually, I've got plans to implement this with a better abstraction than the current code, using some ideas from another package. Stay tuned!

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

No branches or pull requests

2 participants