fix(core): update
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/qenv',
|
||||
version: '6.0.4',
|
||||
version: '6.0.5',
|
||||
description: 'easy promised environments'
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './qenv.plugins.js';
|
||||
|
||||
export class ConfigVaultAdapter {
|
||||
export class CloudlyAdapter {
|
||||
public configVaultUrl: string;
|
||||
|
||||
constructor(configVaultUrl?: string) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ConfigVaultAdapter } from './qenv.classes.configvaultadapter.js';
|
||||
import { CloudlyAdapter } from './qenv.classes.configvaultadapter.js';
|
||||
import * as plugins from './qenv.plugins.js';
|
||||
|
||||
export type TEnvVarRef = string | (() => Promise<string>);
|
||||
@ -10,17 +10,17 @@ export class Qenv {
|
||||
public keyValueObject: { [key: string]: any } = {};
|
||||
public logger = new plugins.smartlog.ConsoleLog();
|
||||
|
||||
public configVaultAdapter: ConfigVaultAdapter;
|
||||
public cloudlyAdapter: CloudlyAdapter;
|
||||
|
||||
public qenvFilePathAbsolute: string;
|
||||
public envFilePathAbsolute: string;
|
||||
|
||||
constructor(
|
||||
qenvFileBasePathArg: string = process.cwd(),
|
||||
envFileBasePathArg: string,
|
||||
envFileBasePathArg?: string,
|
||||
failOnMissing: boolean = true
|
||||
) {
|
||||
this.configVaultAdapter = new ConfigVaultAdapter();
|
||||
this.cloudlyAdapter = new CloudlyAdapter();
|
||||
this.initializeFilePaths(qenvFileBasePathArg, envFileBasePathArg);
|
||||
this.loadRequiredEnvVars();
|
||||
this.loadAvailableEnvVars();
|
||||
@ -32,10 +32,12 @@ export class Qenv {
|
||||
plugins.path.resolve(qenvFileBasePathArg),
|
||||
'qenv.yml'
|
||||
);
|
||||
this.envFilePathAbsolute = plugins.path.join(
|
||||
plugins.path.resolve(envFileBasePathArg),
|
||||
'env.json'
|
||||
);
|
||||
if (envFileBasePathArg) {
|
||||
this.envFilePathAbsolute = plugins.path.join(
|
||||
plugins.path.resolve(envFileBasePathArg),
|
||||
'env.json'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private loadRequiredEnvVars() {
|
||||
@ -144,6 +146,9 @@ export class Qenv {
|
||||
}
|
||||
|
||||
private getFromEnvJsonFile(envVarName: string): string | undefined {
|
||||
if (!plugins.smartfile.fs.fileExistsSync(this.envFilePathAbsolute)) {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
const envJson = plugins.smartfile.fs.toObjectSync(this.envFilePathAbsolute);
|
||||
const value = envJson[envVarName];
|
||||
|
Reference in New Issue
Block a user