MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / getConfigSync

Method getConfigSync

packages/context/src/context.ts:354–371  ·  view source on GitHub ↗

* Resolve configuration synchronously for the binding by key * * @param key - Binding key * @param propertyPath - Property path for the option. For example, `x.y` * requests for `config.x.y`. If not set, the `config` object will be * returned. * @param resolutionOptions - Options f

(
    key: BindingAddress,
    propertyPath?: string,
    resolutionOptions?: ResolutionOptions,
  )

Source from the content-addressed store, hash-verified

352 * @param resolutionOptions - Options for the resolution.
353 */
354 getConfigSync<ConfigValueType>(
355 key: BindingAddress,
356 propertyPath?: string,
357 resolutionOptions?: ResolutionOptions,
358 ): ConfigValueType | undefined {
359 const valueOrPromise = this.getConfigAsValueOrPromise<ConfigValueType>(
360 key,
361 propertyPath,
362 resolutionOptions,
363 );
364 if (isPromiseLike(valueOrPromise)) {
365 const prop = propertyPath ? ` property ${propertyPath}` : '';
366 throw new Error(
367 `Cannot get config${prop} for ${key} synchronously: the value is a promise`,
368 );
369 }
370 return valueOrPromise;
371 }
372
373 /**
374 * Unbind a binding from the context. No parent contexts will be checked.

Callers 4

mainFunction · 0.95

Calls 2

isPromiseLikeFunction · 0.90

Tested by

no test coverage detected