@@ -13,9 +13,15 @@ const isFunction = x => is(x) === '[object Function]';
1313const parse = ( items , converter ) => items . map ( t => converter ( t , 10 ) ) ;
1414const mapNums = items => parse ( items , parseInt ) ;
1515const validType = item => [ 'number' , 'boolean' , 'string' ] . includes ( item ) ;
16+ let store = { ...process . env } ;
1617
1718module . exports = Object
1819 . create ( {
20+ async _mergeSecrets_ ( { fetcherFunc } ) {
21+ const secret = await fetcherFunc ( ) ;
22+ store = { ...store , ...secret } ;
23+ return this ;
24+ } ,
1925 /**
2026 * @description Fetches an IP address from the environment. If the value found under the specified key is not a valid IPv4
2127 * or IPv6 IP and there's no default value, null is returned. If a default value is provided and it is a valid IPv4 or IPv6
@@ -123,8 +129,8 @@ module.exports = Object
123129 }
124130
125131 keys . some ( key => {
126- if ( ok ( process . env [ key ] ) ) {
127- value = process . env [ key ] ;
132+ if ( ok ( store [ key ] ) ) {
133+ value = store [ key ] ;
128134 return true ;
129135 }
130136 return false ;
@@ -172,7 +178,7 @@ module.exports = Object
172178 * @param {(string|string[]) } keys - A unique key or array of keys
173179 *
174180 */
175- ok : ( ...keys ) => keys . every ( key => ok ( process . env [ key ] ) ) ,
181+ ok : ( ...keys ) => keys . every ( key => ok ( store [ key ] ) ) ,
176182
177183 /**
178184 * @description This method ensures 1 to many environment variables either
@@ -262,7 +268,7 @@ module.exports = Object
262268 getBool ( key , defaultVal ) {
263269 let value ;
264270
265- value = process . env [ key ] ;
271+ value = store [ key ] ;
266272
267273 if ( ok ( value ) ) {
268274 value = value . toLowerCase ( ) . trim ( ) ;
0 commit comments