Q.Config Class
Holds application config
Item Index
Methods
clear
-
[keys=null]
Clears the value of a field, removing that key from the tree
Parameters:
Returns:
Returns whether the field to be cleared was found
clearOnServer
-
filename
-
[keys=null]
-
callback
-
[noSave=false]
Modify a config file by clearing some data Config file is searched in APP_DIR/files forder. If config server url is defined the filename is searched on config server
Parameters:
-
filename
StringThe name of the config file. If config server is defined, file is changed there
-
[keys=null]
String | Array optionalA key or an array of keys for traversing the tree. If keys are not supplied the file is cleared If all-but-last keys point to plain array, last key is interpreted as a member of that array and only this array member is removed If all-but-last keys point to associative array (A) and last key is plain array (B) all keys from array A which are in array B are unset
-
callback
FunctionCallback receives error as arguments
-
[noSave=false]
Boolean optionalif true the new tree is returned as callback second argument and not saved
expect
-
keys
Gets the value of a configuration field. If it is null or not set, throws an exception. Otherwise, it is guaranteed to return a non-null value. May throw an exception if the config field is missing.
Returns:
Only returns non-null values
get
-
[keys=[]
-
[def=undefined]
Gets the value of a configuration field
Parameters:
Returns:
The configuration field if it is found, otherwise def or undefined.
getFromServer
-
filename
-
callback
Get contents of config file Config file is searched in APP_DIR/files forder. If config server url is defined the filename is searched on config server
listen
-
callback
Start config server listener. Called from Q.Bootstrap.configure
Parameters:
-
callback
Function
load
-
filename
Loads a configuration file and merges it into the internal config.
Parameters:
-
filename
StringThe filename of the file to load.
merge
-
second
Merges a configuration over the top of an existing configuration
save
-
filename
-
[arrayPath=[]
-
[prefixPath=[]
-
[callback=null]
Saves the configuration to a file
serverInfo
()
Mixed
Check for config server url and return it if found
Returns:
Config server information or false if config server is not defined (if called from 'Q/config' listener also returns false if config server itself is requested)
set
-
keys
-
value
Sets the value of a configuration field
setOnServer
-
filename
-
data
-
callback
-
[clear=false]
Modify a config file by merging over new data Config file is searched in APP_DIR/files forder. If config server url is defined the filename is searched on config server