meshblu-config
Meshblu Config from environment or JSON file
Install
npm install meshblu-config
Usage
var MeshbluConfig = ;var meshbluConfig = ;var config = meshbluConfig; var Meshblu = ;var meshblu = Meshblu;
Options (showing default values)
Functions
Constructor
Parameter | Type | Required | Description |
---|---|---|---|
options | object | no | can contain any of these keys: envVars, defaultFilename, env |
var meshbluConfig = envVars: uuid: "MESHBLU_UUID" resolveSrv: "MESHBLU_RESOLVE_SRV"var meshbluConfig = defaultFilename: './something-like-meshblu.json'var meshbluConfig = env: "MESHBLU_UUID": "the-uuid"
generate
Parse the default file, environment, and data and return the combined configuration
Parameter | Type | Required | Description |
---|---|---|---|
data | object | no | Data to process |
var data = meshbluConfig
Advanced Functions
get
Returns the current config
Parameter | Type | Required | Description |
---|
var data = meshbluConfig;
fromFile
Loads any values from the JSON file into the config
Parameter | Type | Required | Description |
---|---|---|---|
filename | string | no | JSON file to parse, defaults to ``./meshblu.json` |
meshbluConfigvar data = meshbluConfig;
fromEnv
Loads any values from the env
Parameter | Type | Required | Description |
---|---|---|---|
env | object | no | Environment to use, defaults to process.env |
meshbluConfigvar data = meshbluConfig;
fromData
Loads any values from the env
Parameter | Type | Required | Description |
---|---|---|---|
data | object | yes | Data to use |
meshbluConfigvar data = meshbluConfig;