mybase 1.0.32 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/mybase.js +8 -2
  2. package/package.json +1 -1
package/mybase.js CHANGED
@@ -124,10 +124,12 @@ function vaultRead(vault, key) {
124
124
  })
125
125
  }
126
126
 
127
- function vaultFill(vault, obj, ignoreError = false) {
127
+ function vaultFill(vault, obj, ignoreError = false, keepCache=true) {
128
128
  // v2.1
129
129
  // fills all strings with ^vault@/secret/... with proper vault values
130
130
  // if you call it again, it does reload the configuration
131
+ // v2.2
132
+ // supports keepCache - if vault fails, we will keep previous values instead of filling with false
131
133
  return new Promise(async function(resolve, reject) {
132
134
  function findVaultKeyMappings(config, keys = []) {
133
135
 
@@ -158,6 +160,11 @@ function vaultFill(vault, obj, ignoreError = false) {
158
160
  if (config[i] !== null) {
159
161
 
160
162
  if (config[i] && config[i].constructor.name === 'Object' && config[i].hasOwnProperty('__vaultkey')) {
163
+ if (keepCache) {
164
+ if (vaultResults[config[i]['__vaultkey']]) config[i] = vaultResults[config[i]['__vaultkey']]
165
+ }
166
+
167
+ else
161
168
  config[i] = vaultResults[config[i]['__vaultkey']]
162
169
  continue
163
170
  }
@@ -198,7 +205,6 @@ function vaultFill(vault, obj, ignoreError = false) {
198
205
 
199
206
  resolve(true)
200
207
  })
201
-
202
208
  }
203
209
 
204
210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mybase",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "",
5
5
  "main": "mybase.js",
6
6
  "scripts": {