config-model

Members

(static) client :object

Source:
Type:
  • object

(static) server :object

Source:
Type:
  • object

Methods

(static) getThemesSupported(themeList) → {Array.<string>}

Source:

Returns a list of supported themes, in case a list is provided only the ones that exists are returned.

Parameters:
Name Type Description
themeList Array.<string>

A list of themes e.g ['formhub', 'grid']

Returns:

An list of supported theme names

Type
Array.<string>

(inner) _convertNumbers(str) → {string|number}

Source:

Convert a non-empty string number to a number.

Parameters:
Name Type Description
str string

A stringified number

Returns:

an input value or unstrigified number

Type
string | number

(inner) _convertType(str) → {string|boolean|null}

Source:

Converts stringified booleans and null to original types

Parameters:
Name Type Description
str string

A thing to be converted.

Returns:

an un-stringified value or input value itself

Type
string | boolean | null

(inner) _emptyObjectProperties(obj)

Source:

Replaces all non-null and non-object property values with empty string.

Parameters:
Name Type Description
obj object

A simple object

(inner) _extractRedisConfigFromUrl(redisUrl) → {Object}

Source:

Parses a redis URL and returns an object with host, port and password properties.

Parameters:
Name Type Description
redisUrl string

A compliant redis url

Returns:

config object

Type
Object

(inner) _findNumberIndex(arr, startopt) → {number|undefined}

Source:

Finds the index of the first array item that is a number.

Parameters:
Name Type Attributes Default Description
arr Array.<(string|number)>

Array of strings and numbers

start number <optional>
0

Start index

Returns:

The found index

Type
number | undefined

(inner) _findSetting(obj, envName, prefix) → {Object}

Source:

Searches the configuration object to find a match for an environment variable, or the first part of such a variable.

Parameters:
Name Type Description
obj object

Configuration object

envName string

Environment variable name or the first part of one

prefix string

Prefix to use (for nested objects)

Returns:

2-item array of object and property name

Type
Object

(inner) _getEmptyClone(obj) → {object}

Source:

Returns an empty clone of the provided simple object

Parameters:
Name Type Description
obj object

A simple object

Returns:

Clone of input object with emptied properties

Type
object

(inner) _setRedisConfigFromEnv()

Source:

Overrides any redis settings if a special enviroment URL variable is set.

(inner) _updateConfigFromEnv()

Source:

Updates all configuration items for which an environment variable was set.

(inner) _updateConfigItemFromEnv(envVarName)

Source:

Updates a configuration item that corresponds to the provided environment variable name.

Parameters:
Name Type Description
envVarName string

environment variable name