mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
chore(core): add comments
This commit is contained in:
parent
ef9bd97390
commit
a6d4494c0e
1 changed files with 26 additions and 0 deletions
|
@ -27,6 +27,11 @@ export default class GlobalValues {
|
|||
* - Admin Console will NOT be served under admin tenant since the cloud service will do.
|
||||
* - Incoming requests will use glob matching to parse the tenant ID from the request URL.
|
||||
*
|
||||
* ```ts
|
||||
* // ENDPOINT='https://*.domain.com'
|
||||
* getTenantEndpoint('foo') => 'https://foo.domain.com'
|
||||
* ```
|
||||
*
|
||||
* **When DBMT is disabled**
|
||||
*
|
||||
* - For non-admin tenants, tenant endpoint will always be `urlSet.endpoint`.
|
||||
|
@ -51,6 +56,27 @@ export default class GlobalValues {
|
|||
/** @see urlSet For detailed explanation. */
|
||||
public readonly isDomainBasedMultiTenancy = this.urlSet.endpoint.hostname.includes('*');
|
||||
|
||||
/**
|
||||
* This value indicates path-based multi-tenancy (PBMT) is enabled by setting env variable `PATH_BASED_MULTI_TENANCY` to a truthy value.
|
||||
*
|
||||
* Note the value will always be `false` if domain-based multi-tenancy is enabled.
|
||||
*
|
||||
* **When PBMT is enabled**
|
||||
*
|
||||
* - For non-admin tenants, tenant endpoint will be generated by appending the tenant ID to `urlSet.endpoint`.
|
||||
* - For admin tenant, if `adminUrlSet` has no endpoint available, tenant endpoint will be generated by appending the tenant ID to `urlSet.endpoint`.
|
||||
* - Admin Console will NOT be served under admin tenant since the cloud service will do.
|
||||
* - Incoming requests will try to match the position of pathname segments of the URLs in `urlSet.deduplicated()` to parse the tenant ID from the request URL.
|
||||
*
|
||||
* ```ts
|
||||
* // ENDPOINT='https://domain.com/foo'
|
||||
* getTenantEndpoint('bar') => 'https://domain.com/foo/bar'
|
||||
* matchTenantId('https://domain.com/foo/bar') => 'bar'
|
||||
* matchTenantId('http://localhost:3001/foo/bar') => 'foo'
|
||||
* ```
|
||||
*
|
||||
* @see urlSet
|
||||
*/
|
||||
public readonly isPathBasedMultiTenancy =
|
||||
!this.isDomainBasedMultiTenancy && yes(getEnv('PATH_BASED_MULTI_TENANCY'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue