@adobe/aio-lib-core-config
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -32,3 +32,3 @@ /* @flow */ | ||
const NEWLINE = '\n' | ||
const RE_INI_KEY_VAL = /^\s*([\w.-\\$]+)\s*=\s*(.*)?\s*$/ | ||
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/ | ||
const RE_NEWLINES = /\\n/g | ||
@@ -35,0 +35,0 @@ const NEWLINES_MATCH = /\n|\r|\r\n/ |
{ | ||
"_args": [ | ||
[ | ||
"dotenv@8.2.0", | ||
"aio-cli-plugin-config" | ||
] | ||
], | ||
"_from": "dotenv@8.2.0", | ||
@@ -6,3 +12,3 @@ "_id": "dotenv@8.2.0", | ||
"_integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", | ||
"_location": "/dotenv", | ||
"_location": "/@adobe/aio-lib-core-config/dotenv", | ||
"_phantomChildren": {}, | ||
@@ -20,14 +26,11 @@ "_requested": { | ||
"_requiredBy": [ | ||
"/" | ||
"/@adobe/aio-lib-core-config" | ||
], | ||
"_resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", | ||
"_shasum": "97e619259ada750eea3e4ea3e26bceea5424b16a", | ||
"_spec": "dotenv@8.2.0", | ||
"_where": "/Users/shazron/Documents/git/adobe/aio-lib-core-config", | ||
"_spec": "8.2.0", | ||
"_where": "aio-cli-plugin-config", | ||
"bugs": { | ||
"url": "https://github.com/motdotla/dotenv/issues" | ||
}, | ||
"bundleDependencies": false, | ||
"dependencies": {}, | ||
"deprecated": false, | ||
"description": "Loads environment variables from .env file", | ||
@@ -34,0 +37,0 @@ "devDependencies": { |
{ | ||
"name": "@adobe/aio-lib-core-config", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Adobe I/O Configuration Module", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -18,3 +18,6 @@ /* | ||
module.exports = (() => { | ||
/** | ||
* This class provides methods to access the config for Adobe I/O libraries. | ||
*/ | ||
class ConfigAPI { | ||
/** | ||
@@ -24,7 +27,8 @@ * Gets the value for a key in the Config. | ||
* | ||
* @global | ||
* @param {string} [key=''] the key to get the value from | ||
* @param {string} [source] 'global', 'local', or 'env'. Defaults to searching the consolidated config. | ||
*/ | ||
this.get = (key, source) => config.get(key, source) | ||
get(key, source) { | ||
config.get(key, source) | ||
} | ||
@@ -34,3 +38,2 @@ /** | ||
* | ||
* @global | ||
* @param {string} key the key to set the value to | ||
@@ -40,3 +43,5 @@ * @param {string} value the value to save for the key | ||
*/ | ||
this.set = (key, value, local) => config.set(key, value, local) && this | ||
set(key, value, local) { | ||
return config.set(key, value, local) && this | ||
} | ||
@@ -46,14 +51,15 @@ /** | ||
* | ||
* @global | ||
* @param {string} key the key to delete the value from | ||
* @param {string} [local=false] Set to true to delete the value in the local config. Defaults to false (save to global config). | ||
*/ | ||
this.delete = (key, local) => config.set(key, null, local) && this | ||
delete(key, local) { | ||
return config.set(key, null, local) && this | ||
} | ||
/** | ||
* Reload the Config from all the config file(s) | ||
* @global | ||
*/ | ||
this.reload = () => config.reload() && this | ||
reload() { | ||
return config.reload() && this | ||
} | ||
@@ -63,7 +69,8 @@ /** | ||
* | ||
* @global | ||
* @function | ||
* @return {Promise} | ||
*/ | ||
this.getPipedData = pipe | ||
get getPipedData() { | ||
return pipe | ||
} | ||
@@ -73,9 +80,13 @@ /** | ||
* | ||
* @global | ||
* @function | ||
* @param {boolean} [force=false] force reload of the .env file | ||
*/ | ||
this.dotenv = dotenv | ||
get dotenv() { | ||
return dotenv | ||
} | ||
} | ||
return this | ||
})() | ||
/** | ||
* @returns {ConfigAPI} | ||
*/ | ||
module.exports = new ConfigAPI() |
626
53341
21