Node SDK

Module lib/rstreams-config-provider-chain

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Enumeration
  • Class

Index

References

Renames and re-exports ConfigProviderChain

Type aliases

Provider: (() => default) | default | ConfigurationResources

The Configuring RStreams guide might be helpful.

Creates a configuration provider chain that searches for RStreams configurations in a list of configuration providers specified by the {providers} property.

By default, the chain will use the {defaultProviders} to resolve configurations. These providers will look in the environment using the {RStreams.EnvironmentConfiguration} class with the 'LEO' and 'RSTREAMS' prefixes.

Setting Providers

Each provider in the {providers} list should be a function that returns a {RStreams.Configuration} object, or a hardcoded Configuration object. The function form allows for delayed execution of the credential construction.

Resolving Configurations from a Chain

Call {resolve} to return the first valid credential object that can be loaded by the provider chain.

For example, to resolve a chain with a custom provider that checks a file on disk after the set of {defaultProviders}:

let envProvider = new RStreams.EnvironmentConfiguration('MyEnvVar');
let chain = new RStreams.ConfigProviderChain([envProvider], ProvidersInputType.Append);
chain.resolveSync();

The above code will return the envProvider object if the env contains configuration and the defaultProviders do not contain any configuration settings.

!attribute

providers

returns
a list of configuration objects or functions that return configuration
objects. If the provider is a function, the function will be
executed lazily when the provider needs to be checked for valid
configuration. By default, this object will be set to the
{defaultProviders}.
see

defaultProviders

Generated using TypeDoc