Members
(static) dependencies :Array.<string>
Class dependencies:
['app', 'config.grammar', 'file']
.
Methods
get(keyopt, defaultValueopt)
Get configuration value.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | null |
<optional> |
null
|
The configuration key. |
defaultValue |
* | null |
<optional> |
null
|
The default value to use if the value is not in configuration. |
Returns:
The configuration value.
- Type
- *
set(key, value)
Set configuration value.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The configuration key. |
value |
* | The configuration value. |
Returns:
The current config repository instance.
merge(key, value, overwriteopt)
Merge configuration value to existing value.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | The configuration key. | ||
value |
* | The configuration value. | ||
overwrite |
boolean |
<optional> |
false
|
Flag that indicates if the old value should be overwritten or merged. |
Returns:
The current config repository instance.
setConfig(config)
Set global configuration.
Parameters:
Name | Type | Description |
---|---|---|
config |
* | The full configuration object. |
Returns:
The current config repository instance.
loadConfigFromFolder(folder, overwriteopt)
Set global configuration based on folder files.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
folder |
string | The folder to search configuration file into. | ||
overwrite |
boolean |
<optional> |
false
|
Flag that indicates if the current configuration should be overridden or merged. |
Returns:
The current config repository instance.
loadConfig(key, filePath, overwriteopt)
Load configuration from file and store as a root index.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | The configuration key. | ||
filePath |
string | The file to load which contains the configuration object for the specified key. | ||
overwrite |
boolean |
<optional> |
false
|
Flag that indicates if the current configuration should be overridden or merged. |
Returns:
The current config repository instance.
setConfigFromFile(file)
Set global configuration from file.
Parameters:
Name | Type | Description |
---|---|---|
file |
string | Array.<string> | The file, or set of files, to load to set config from. If a set of file is given, the first existing one will be used, and all the others will be ignored. |
Returns:
The current config repository instance.
formatValues(config)
Format values with grammar.
Parameters:
Name | Type | Description |
---|---|---|
config |
* | The configuration value, either a single value or a whole object. |
Returns:
The formatted value or values.
- Type
- *