EnvAwareConfigProvider

EnvAwareConfigProvider

new EnvAwareConfigProvider(configDir, baseName, envFlagopt)

Environment-aware config provider

Source:
Parameters:
Name Type Attributes Default Description
configDir string

The base directory of config files

baseName string

The basename of the config file

envFlag string <optional>
"development"

Environment flag

Methods

(static) getItem(key, defaultValue) → {*}

Get config item by dotted path.

Source:
Parameters:
Name Type Description
key string
defaultValue *
Returns:
Type:
*

(async, static) load_() → {Promise.<object>}

Start loading the config files

Source:
Returns:
Type:
Promise.<object>

(async, static) save_() → {Promise.<*>}

Start saving the config to files

Source:
Returns:
Type:
Promise.<*>

(static) setItem(key, value) → {JsonConfigProvider}

Update config item by dotted path.

Source:
Parameters:
Name Type Description
key string

The path of config item, e.g. "item.subItem.key" refers to { item: { subItem: { key: "*" } } }

value *

New value of config item

Returns:
Type:
JsonConfigProvider