Create a local string parameter.

localString(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

Create an env string parameter. The parameter name and alias will be set equal.

envString(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name and alias.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

Create an AWS SSM string parameter.

ssmString(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

secretsManagerString

lib/factories.doc.js

Create an AWS Secrets Manager string parameter.

secretsManagerString(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

secretsManagerJson

lib/factories.doc.js

Create an AWS Secrets Manager JSON parameter.

secretsManagerJson(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

ssmNonNegativeInt

lib/factories.doc.js

Create an AWS SSM non-negative integer parameter.

ssmNonNegativeInt(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

localNonNegativeInt

lib/factories.doc.js

Create a local non-negative integer parameter.

localNonNegativeInt(name: string, fallback: string?): Parameter
Parameters
name (string) Parameter name.
fallback (string?) Fallback value if parameter is not found.
Returns
Parameter: The parameter instance.

Get the configuration. All additional named parameters are passed to the initProvider method of each parameter provider instance.

getConfig(parameters: Object): Promise<Object>
Parameters
parameters (Object = {})
Name Description
parameters.parameters Object (default {}) Parameters to fetch.
parameters.aliases Object (default {}) Parameter key aliases.
parameters.cache Object (default <cache>) In-memory cache-manager cache. In order to cache values across multiple invocations, a cache must be passed in from the outer scope.
parameters.log Object (default <logger>) Pino compatible logger.
Returns
Promise<Object>: The config.

Parameter model.

new Parameter(parameters: Object)
Parameters
parameters (Object)
Name Description
parameters.name string Name for the parameter.
parameters.alias string Alias for the parameter.
parameters.fallback string? Fallback value if parameter value is null, undefined, or not found.
parameters.Provider string Constructor for the underlying provider.
parameters.validator Function (default <always-valid>) Boolean function that validates the parsed parameter.
parameters.parser Function (default <identity>) Function to parse the parameter.
parameters.isSensitive Boolean (default false) If the parameter value is sensitive.
Properties
name (string) : Name of the parameter.
name (string) : Alias of the parameter.
providerName (string) : Name of the provider.
Instance Members
get(key)
initProvider()

ParameterValidationError

lib/parameter.doc.js

Parameter validation error.

new ParameterValidationError(key: string, data: any)

Extends Error

Parameters
key (string) Parameter key that failed validation.
data (any) Value that failed validation.
Properties
key (string) : Parameter key that failed validation.
data (any) : Value that failed validation.

ParameterParsingError

lib/parameter.doc.js

Parameter parsing error.

new ParameterParsingError(key: string, data: any, err: Error)

Extends Error

Parameters
key (string) Parameter key that failed parsing.
data (any) Value that failed parsing.
err (Error) Parse error.
Properties
key (string) : Parameter key that failed parsing.
data (any) : Value that failed parsing.
error (Error) : Parse error.

Env provider.

new EnvProvider(parameters: Object)
Parameters
parameters (Object)
Name Description
parameters.env Object (default process.env) Plain object of parameter key-value pairs.
Instance Members
get(parameterName)

Local provider.

new LocalProvider(parameters: Object)
Parameters
parameters (Object)
Name Description
parameters.localParameters Object (default {}) Plain object of parameter key-value pairs.
Instance Members
get(parameterName)

AWS Secrets Manager provider.

new SecretsManagerProvider(parameters: Object)
Parameters
parameters (Object)
Name Description
parameters.secretsManagerClient Object (default <secretsManagerClient>) Instance of a SecretsManagerClient from the AWS SDK.
Instance Members
get(secretId)

AWS SSM provider.

new SsmProvider(parameters: Object)
Parameters
parameters (Object)
Name Description
parameters.ssmClient Object (default <ssmClient>) Instance of an SSMClient from the AWS SDK.
Instance Members
get(parameterName)