diff --git a/docs/en/UI/Angular/Environment.md b/docs/en/UI/Angular/Environment.md new file mode 100644 index 0000000000..b1f47ac864 --- /dev/null +++ b/docs/en/UI/Angular/Environment.md @@ -0,0 +1,99 @@ +# Environment + +Current `Environment` Configuration holds sub config classes. + +```typescript +export interface Environment { + apis: Apis; + application: Application; + hmr?: boolean; + localization?: { defaultResourceName?: string }; + oAuthConfig: AuthConfig; + production: boolean; + remoteEnv?: RemoteEnv; +} +``` + +## Apis + +```typescript +export interface Apis { + [key: string]: ApiConfig; + default: ApiConfig; +} + +export interface ApiConfig { + [key: string]: string; + url: string; +} +``` + +Api config has to have a default config and it may have some additional ones for different modules. +I.e. you may want to connect to different Apis for different modules. + +Take a look at example + +```json +{ + ... + "apis": { + "default": { + "url": "https://localhost:8080", + }, + "AbpIdentity": { + "url": "https://localhost:9090", + } + } +} +``` + +When an api from `AbpIdentity` is called, the request will be sent to `"https://localhost:9090"`. +Everything else will be sent to `"https://localhost:8080"` + +## Application + +```typescript + export interface Application { + name: string; + baseUrl?: string; + logoUrl?: string; +} +``` + +* `name`: Name of the backend Application. It is also used by `logo.component` if `logoUrl` is not provided. +* `logoUrl`: Url of application logo. It is used by `logo.component` +* `baseUrl`: [For detailed information](./Multi-Tenancy.md#domain-tenant-resolver) + +## Localization + +You can read about `Localization` [here in detail](./Localization.md) + +## OAuthConfig + +..... + +## RemoteEnvironment + +To integrate an existing config json into environment, you need to set `remoteEnv` + +```typescript +export type customMergeFn = ( + localEnv: Partial, + remoteEnv: any, +) => Config.Environment; + +export interface RemoteEnv { + url: string; + mergeStrategy: 'deepmerge' | 'overwrite' | customMergeFn; + method?: string; + headers?: ABP.Dictionary; +} +``` + +* `url` *: Required. The url to be used to retrieve environment config +* `mergeStrategy`: Defines how local and remote environment json will be merged + * `deepmerge`: Both local and remote environment json will be merged recursively. If both config has same nested path, remote environment will be prioritized. + * `overwrite`: Remote environment will be used and local environment will be ignored. + * `customMergeFn`: You can also provide your own merge function as shown in the example. It will take two parameters, `localEnv: Partial` and `remoteEnv` and it needs to return a `Config.Environment` object. +* `method`: HTTP method to be used when retrieving environment config. Default: `GET` +* `headers`: If extra headers are needed for the request, it can be set through this field. \ No newline at end of file diff --git a/docs/en/UI/Angular/Multi-Tenancy.md b/docs/en/UI/Angular/Multi-Tenancy.md index fb9fb54f76..2f768de32a 100644 --- a/docs/en/UI/Angular/Multi-Tenancy.md +++ b/docs/en/UI/Angular/Multi-Tenancy.md @@ -20,7 +20,7 @@ On the page above, you can; You can switch between existing tenants by using the tenant switching component in the child pages of the `AccountLayoutComponent` (like Login page). Angular UI sends the selected tenant id to the backend as `__tenant` header on each request. -## Domain Tenant Resolver +

Domain Tenant Resolver

Angular UI can get the tenant name from the app running URL. You can determine the current tenant by subdomain (like mytenant1.mydomain.com) or by the whole domain (like mytenant.com). To do this, you need to set the `application.baseUrl` property in the environment: diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 660f2b1b60..411cced68d 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -219,11 +219,11 @@ "items": [ { "text": "Email Sending System", - "path": "Emailing.md", + "path": "Emailing.md" }, { "text": "MailKit Integration", - "path": "MailKit.md", + "path": "MailKit.md" } ] }, @@ -423,6 +423,10 @@ "text": "Migration Guide v2.x to v3", "path": "UI/Angular/Migration-Guide-v3.md" }, + { + "text": "Environment", + "path": "UI/Angular/Environment.md" + }, { "text": "Service Proxies", "path": "UI/Angular/Service-Proxies.md"