Page Contents

Home > @loopback/context > Context > getConfigAsValueOrPromise

Context.getConfigAsValueOrPromise() method

Get the value or promise of configuration for a given binding by key

Signature:

getConfigAsValueOrPromise<ConfigValueType>(key: BindingAddress, configPath?: string, resolutionOptions?: ResolutionOptions): ValueOrPromise<ConfigValueType | undefined>;

Parameters

Parameter Type Description
key BindingAddress Binding key
configPath string Property path for the option. For example, x.y requests for <config>.x.y. If not set, the <config> object will be returned.
resolutionOptions ResolutionOptions Options for the resolution. - optional: if not set or set to true, undefined will be returned if no corresponding value is found. Otherwise, an error will be thrown.

Returns:

ValueOrPromise<ConfigValueType | undefined>