Skip to main content

HostDiscovery.fromConfig()

Home > @backstage/backend-app-api > HostDiscovery > fromConfig

Creates a new HostDiscovery discovery instance by reading from the backend config section, specifically the .baseUrl for discovering the external URL, and the .listen and .https config for the internal one.

Can be overridden in config by providing a target and corresponding plugins in discovery.endpoints. eg.

discovery:
endpoints:
- target: https://internal.example.com/internal-catalog
plugins: [catalog]
- target: https://internal.example.com/secure/api/{{pluginId}}
plugins: [auth, permission]
- target:
internal: https://internal.example.com/search
external: https://example.com/search
plugins: [search]

The basePath defaults to /api, meaning the default full internal path for the catalog plugin will be http://localhost:7007/api/catalog.

Signature:

static fromConfig(config: Config, options?: {
basePath?: string;
}): HostDiscovery;

Parameters

ParameterTypeDescription
configConfig
options{ basePath?: string; }(Optional)

Returns:

HostDiscovery