-
Notifications
You must be signed in to change notification settings - Fork 14
MultiTenant
v7files can operate in a multi-tenant mode, where the same instance can be used to connect to a separate MongoDB database for each tenant. This makes it easy to completely isolate the tenants from each other, and also calculate each tenant's resource use (they will not share storage).
If there are only a few tenants and they do not need to be added on-the-fly, an alternative to the full multi-tenant mode is configuring multiple endpoints. As almost all configuration options can be specified on a per-endpoint-basis, this allows for greater degree of customization as well. For example, they could all use different authentication providers (in multi-tenant mode, they would all use the same endpoint configuration).
Note that you can also combine multiple endpoints with multiple tenants(multi-tenant mode is also configurable for each endpoint).
In multi-tenant mode the same endpoint is made available for multiple tenants. Each tenant is assigned a separate MongoDB database, so that all data stored is kept isolated from other tenants.
You can place an endpoint in multi-tenant mode by setting the configuration option v7files.tenants
:
# "path"-based multi-tenant mode uses the first path segment of the endpoint url
# as the tenant name (= database name), the document root will start after that
v7files.tenants = path
When you do this, the first URL path component in the endpoint's context is used as the tenant name. The file path starts after that.
webdav.endpoints = /webdav
/webdav.v7files.tenants = path
A request GET /webdav/charly/docs/a.txt
will access /docs/a.txt
in the database assigned to tenant charly
.
For now, the tenant name is used as the database name.
A tenant is only valid if the database already exists and has the v7files
metadata collection (so that getting some random HTTP requests does not result in creating new databases).