Constructor
new ConfigModule()
- Source:
Extends
Members
configFilePath :String
- Description:
- Path to the user configuration file
- Source:
Path to the user configuration file
Type:
mutableAttributes :Array.<String>
- Description:
- The keys for all attributes which can be modified during runtime
- Source:
The keys for all attributes which can be modified during runtime
Type:
publicAttributes :Array.<String>
- Description:
- The keys for all attributes marked as public
- Source:
The keys for all attributes marked as public
Type:
Methods
envVarToConfigKey(envVar) → {String}
- Description:
- Parses an environment variable key into a format expected by this module
- Source:
Parameters:
Name |
Type |
Description |
envVar |
String
|
|
Returns:
The formatted key
-
Type
-
String
get(attr) → {*}
- Description:
- Returns a value for a given attribute
- Source:
Parameters:
Name |
Type |
Description |
attr |
String
|
Attribute key name |
Returns:
The attribute's value
-
Type
-
*
getPublicConfig(isMutable) → {Object}
- Description:
- Retrieves all config options marked as 'public'
- Source:
Parameters:
Name |
Type |
Description |
isMutable |
Boolean
|
Whether options should also be mutable |
Returns:
-
Type
-
Object
has(attr) → {Boolean}
- Description:
- Determines whether an attribute has a set value
- Source:
Parameters:
Name |
Type |
Description |
attr |
String
|
Attribute key name |
Returns:
Whether the value exists
-
Type
-
Boolean
(async) init()
- Source:
(async) initRouter() → {Promise}
- Description:
- Adds routing functionality
- Source:
Returns:
-
Type
-
Promise
(async) processModuleSchema(pkg, jsonschema) → {Promise}
- Description:
- Processes and validates a single module config schema (checks the user config specifies any required fields, and that they are the expected type)
- Source:
Parameters:
Name |
Type |
Description |
pkg |
Object
|
Package.json data |
jsonschema |
JsonSchemaModule
|
Module instance for validation |
Returns:
-
Type
-
Promise
set(attr, val, options)
- Description:
- Stores a value for the passed attribute
- Source:
Parameters:
Name |
Type |
Description |
attr |
String
|
Attribute key name |
val |
*
|
Value to set |
options |
objeect
|
Custom options
Properties
Name |
Type |
Description |
force |
objeect
|
Whether to force an update |
|
(async) storeEnvSettings() → {Promise}
- Description:
- Copy env values to config
- Source:
Returns:
-
Type
-
Promise
(async) storeSchemaSettings() → {Promise}
- Description:
- Processes all module config schema files
- Source:
Returns:
-
Type
-
Promise
(async) storeUserSettings() → {Promise}
- Description:
- Loads the relevant config file into memory
- Source:
Returns:
-
Type
-
Promise