fix(core): update
This commit is contained in:
30
ts/qenv.classes.configvaultadapter.ts
Normal file
30
ts/qenv.classes.configvaultadapter.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as plugins from './qenv.plugins.js';
|
||||
|
||||
export class ConfigVaultAdapter {
|
||||
public configVaultUrl: string;
|
||||
|
||||
constructor(configVaultUrl?: string) {
|
||||
this.configVaultUrl = configVaultUrl;
|
||||
}
|
||||
|
||||
public async getConfigBundle(): Promise<plugins.configvaultInterfaces.data.IConfigBundle> {
|
||||
if (this.configVaultUrl) {
|
||||
console.log(`ConfigVault specified through constructor`)
|
||||
} else if (process.env['CONFIGVAULT_URL']) {
|
||||
this.configVaultUrl = process.env['CONFIGVAULT_URL'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parsedUrl = new URL(this.configVaultUrl);
|
||||
|
||||
const tr =
|
||||
new plugins.typedrequest.TypedRequest<plugins.configvaultInterfaces.requests.IReq_GetConfigBundle>(
|
||||
`${parsedUrl.host}/typedrequest`,
|
||||
'getConfigBundle'
|
||||
);
|
||||
const response = await tr.fire({
|
||||
authorization: parsedUrl.pathname.replace('/', ''),
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user