Global

Methods

castBool(value, defaultValue, Same)

Parse a boolean config variable.

Environment variables are passed in as strings, but this function can turn values like undefined, '', '0' and 'false' into false.

If a default value is provided, undefined and '' will return the default value.

Values other than undefined, '', '1', '0', 'true', and 'false' will throw.

Parameters:
Name Type Description
value String

Config value

defaultValue Boolean

Value to be returned for undefined or empty inputs

Same Boolean

config value intelligently cast to bool

Source:

generateSecret(prefix, name) → {Buffer}

Generate a secret based on {prefix}_SECRET.

Parameters:
Name Type Description
prefix String
name String
Source:
Returns:
Type
Buffer

getEnv(prefix, name) → {String}

Get a config value from the environment.

Applies the config prefix defined in the constructor.

Parameters:
Name Type Description
prefix String

prefix

name String

Config key (will be prefixed)

Source:
Returns:

Config value or undefined

getEnv('example', 'my_setting') === process.env.EXAMPLE_MY_SETTING

Type
String

loadConfig(prefix, localConfigopt, optionsopt) → {Object}

Parameters:
Name Type Attributes Description
prefix String

Prefix to apply to all env variable names. Should be in lowercase with dashes as separators. Will automatically be converted to uppercase with underscores or other formats as necessary.

localConfig Object <optional>
options Object <optional>
Properties
Name Type Attributes Description
ed25519 Boolean <optional>

'false' if config should not parse ed25519 keypair

Source:
Returns:
  • Frozen Config
Type
Object
Example
const config = loadConfig('prefix', localConfig)
  config.toJS()
  => { foo: {bar: 'baz'} }

  config.getIn(['foo', 'bar'])
  => 'baz'

  config.get('foo').toJS()
  => {bar: 'baz'}

NotificationScheduler(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Description
Notification Class
knex Object
log Logger
processNotification processNotification
Source:

parseKeyConfig()

Parse keypair configuration from the environment

Source:

parseServerConfig()

Parse the server configuration settings from the environment.

Source:

Type Definitions

processNotification(notification) → {Promise}

Callback to process a notification.

Parameters:
Name Type Description
notification Object
Source:
Returns:
Type
Promise

ValidationResult

Type:
  • Object
Properties:
Name Type Description
valid Boolean

Whether the data matched the schema.

errors Array.<Object>

A list of validation errors if any.

Source:

ValidatorFunction(data) → {ValidationResult}

Filter function for JSON data.

Parameters:
Name Type Description
data Object

Data to be validated

Source:
Returns:

Validation result

Type
ValidationResult