JsonConfigProvider

JsonConfigProvider

new JsonConfigProvider(filePath)

JSON file config data source

Source:
Parameters:
Name Type Description
filePath string

The path of config file

Members

config :object

The loaded config

Source:
Type:
  • object

Methods

getItem(key, defaultValue) → {*}

Get config item by dotted path.

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

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

Start loading the config files

Source:
Returns:
Type:
Promise.<object>

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

Start saving the config to files

Source:
Returns:
Type:
Promise.<*>

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