Skip to main content
Version: Next

ConfigSources.toConfig()

Home > @backstage/config-loader > ConfigSources > toConfig

Creates an observable Config implementation from a ConfigSource.

Signature:

static toConfig(source: ConfigSource): Promise<ClosableConfig>;

Parameters

ParameterTypeDescription
sourceConfigSourceThe config source to read from

Returns:

Promise<ClosableConfig>

A promise that resolves to a closable config

Remarks

If you only want to read the config once you can close the returned config immediately.

Example

const sources = ConfigSources.default(...)
const config = await ConfigSources.toConfig(source)
config.close()
const example = config.getString(...)