Skip to content

Latest commit

 

History

History
128 lines (92 loc) · 3.84 KB

README.md

File metadata and controls

128 lines (92 loc) · 3.84 KB

Table of Contents

createConfigurationRepository

Create a new instance of a ConfigurationRepository

Parameters

  • options object? See below
    • options.cache cacheManager? An instance of a cache from the npm package 'cache-manager'. Defaults to in memory cache
    • options.cacheKey string? A key used to isolate the configuration cache from other cache namespaces. Defaults to 'configuration'
    • options.log object? A pino compatible logger. Defaults to a noop logger
    • options.smClient object? An AWS SDK SecretsManager client. Defaults to a new SecretsManager().
    • options.ssmClient object? An AWS SDK SSM client. Defaults to a new SSM().

Returns ConfigurationRepository The configuration repository

ConfigurationRepository

THIS IS NOT INTENDED TO BE CONSTRUCTED BY HAND. Please use createConfigurationRepository

Parameters

  • options object Internal use
    • options.log object Internal use
    • options.ssmRepository object Internal use
    • options.secretsRepository object Internal use

getConfiguration

Get a configuration object based on a provided array of configuration requests

Parameters

Returns object An object with properties based on the ConfigurationRequest objects provided and values of the adapter configuration responses

ConfigurationRequest

A request for a configuration value

Parameters

  • options object See below
    • options.adapter Function? A function that will be passed the raw value and be allowed to modify it before returning (optional, default x=>x)
    • options.key string The key for the requested configuration. For SSM the parameter path, for Secrets manager the secret name.
    • options.propertyName string The property name the value will be assigned to in the response object from getting configuration
    • options.type ConfigurationRequestTypes The type of configuration request

configurationRequestTypes

The available types of configuration requests

local

Local

secret

Secrets manager

ssm

SSM

ConfigurationRequestTypes

configurationRequestTypes accessor object *

isValid

Check to see if a given string is a valid ConfigurationRequestTypes

Parameters

  • possibleType string Possible ConfigurationRequestTypes

Returns boolean True for value, false for invalid