Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
bb9de1b13b | |||
080e133e9f | |||
a284c58a68 | |||
18bb54831d | |||
141c7ed8a7 | |||
037481f195 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/npmextra",
|
"name": "@push.rocks/npmextra",
|
||||||
"version": "4.0.13",
|
"version": "4.0.16",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "do more with npm",
|
"description": "do more with npm",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/npmextra',
|
name: '@push.rocks/npmextra',
|
||||||
version: '4.0.13',
|
version: '4.0.16',
|
||||||
description: 'do more with npm'
|
description: 'do more with npm'
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import * as plugins from './npmextra.plugins.js';
|
import * as plugins from './npmextra.plugins.js';
|
||||||
import * as paths from './npmextra.paths.js';
|
import * as paths from './npmextra.paths.js';
|
||||||
import { KeyValueStore } from './npmextra.classes.keyvaluestore.js';
|
import { KeyValueStore } from './npmextra.classes.keyvaluestore.js';
|
||||||
|
import { env } from 'process';
|
||||||
|
|
||||||
export interface IAppDataOptions {
|
export interface IAppDataOptions {
|
||||||
dirPath?: string;
|
dirPath?: string;
|
||||||
@ -68,8 +69,11 @@ export class AppData {
|
|||||||
if (this.options.envMapping) {
|
if (this.options.envMapping) {
|
||||||
const qenvInstance = new plugins.qenv.Qenv(process.cwd(), '~/.cloudlyrc');
|
const qenvInstance = new plugins.qenv.Qenv(process.cwd(), '~/.cloudlyrc');
|
||||||
for (const key in this.options.envMapping) {
|
for (const key in this.options.envMapping) {
|
||||||
const envValue = await qenvInstance.getEnvVarOnDemand(key);
|
let envValue = await qenvInstance.getEnvVarOnDemand(key);
|
||||||
if (envValue) {
|
if (envValue) {
|
||||||
|
if (key.endsWith('_JSON')) {
|
||||||
|
envValue = JSON.parse(envValue);
|
||||||
|
}
|
||||||
await this.kvStore.writeKey(key, envValue);
|
await this.kvStore.writeKey(key, envValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,4 +103,10 @@ export class AppData {
|
|||||||
console.log('All mandatory keys are present in the appdata');
|
console.log('All mandatory keys are present in the appdata');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async waitForAndGetKey(keyArg: string) {
|
||||||
|
await this.readyDeferred.promise;
|
||||||
|
await this.kvStore.waitForKeysPresent([keyArg]);
|
||||||
|
return this.kvStore.readKey[keyArg];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ export class KeyValueStore {
|
|||||||
return Array.from(this.mandatoryKeys).filter(key => !(key in this.dataObject));
|
return Array.from(this.mandatoryKeys).filter(key => !(key in this.dataObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async waitForKeysPresent(keysArg: []): Promise<void> {
|
public async waitForKeysPresent(keysArg: string[]): Promise<void> {
|
||||||
const missingKeys = keysArg.filter(keyArg => !this.dataObject[keyArg]);
|
const missingKeys = keysArg.filter(keyArg => !this.dataObject[keyArg]);
|
||||||
if (missingKeys.length === 0) {
|
if (missingKeys.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user