Multi-tenant configuration
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
Anyone have any ideas on how I could have different configs (per tenant w/ secrets) and inject them into the application when the User lands on their tenant domain?
I have looked at the official template, but it does not do this. We need to have different configs ( w/ both sensitive and non sensitive keys) because we use ORY Kratos and each tenant needs their own API key, redirect URL, etc.
I am assuming we'll need to inject some config in at runtime both on the frontend and backend? Any solutions/ideas?
I have looked at the official template, but it does not do this. We need to have different configs ( w/ both sensitive and non sensitive keys) because we use ORY Kratos and each tenant needs their own API key, redirect URL, etc.
I am assuming we'll need to inject some config in at runtime both on the frontend and backend? Any solutions/ideas?
7 Replies
@Sloth bear Anyone have any ideas on how I could have different configs (per tenant w/ secrets) and inject them into the application when the User lands on their tenant domain?
I have looked at the official template, but it does not do this. We need to have different configs ( w/ both sensitive and non sensitive keys) because we use ORY Kratos and each tenant needs their own API key, redirect URL, etc.
I am assuming we'll need to inject some config in at runtime both on the frontend and backend? Any solutions/ideas?
if you are building the app before deploying it, you cant inject at runtime.
Sloth bearOP
What approaches have you seen @DirtyCajunRice | AppDir? In regards to what you have said above, essentially the CD process would have to change? Are you getting at having some sort of tenant map?
Golden-winged Warbler
tl;dr, use environment variables or another package for storing them as a config file and singleton
Sloth bearOP
Yes, this partly solves the issue @Golden-winged Warbler. However, now you need to pass the tenant ID around and accept it into different functions.
For example, if I use react query and create a custom hook, this hook will now need the tenant ID passed to it so the correct value can be picked from the tenant config map...
For example, if I use react query and create a custom hook, this hook will now need the tenant ID passed to it so the correct value can be picked from the tenant config map...
Golden-winged Warbler
I would not put all tenant configs in the same file, especially if they have tenant specific secrets. Use one or more file(s) per tenant
it's also pretty common to store tenant / account id / alias in the url path or query