fix(core): update
This commit is contained in:
@ -17,6 +17,26 @@ export abstract class AAgHandler<TClaim> {
|
||||
public abstract typedrouter: plugins.typedrequest.TypedRouter;
|
||||
public abstract checkRequirements(): Promise<IRequirementResult>;
|
||||
|
||||
public async checkQenvFile(pathToQenvFileArg: string) {
|
||||
if(!(await plugins.smartfile.fs.fileExists(pathToQenvFileArg))) {
|
||||
throw new Error(`AgHandler with slug '${this.slug}': qenv file does not exists at ${pathToQenvFileArg}`);
|
||||
}
|
||||
const qenvFile = plugins.smartfile.fs.toObjectSync(pathToQenvFileArg);
|
||||
const missingEnvironmentVariables: string[] = [];
|
||||
for (const envVar of qenvFile.required as string[]) {
|
||||
const result = this.agEnvironment.getEnvVar(envVar);
|
||||
if (!result) {
|
||||
missingEnvironmentVariables.push(envVar);
|
||||
}
|
||||
}
|
||||
if (missingEnvironmentVariables.length > 0) {
|
||||
console.log(`AgHandler with slug '${this.slug}': There are ${missingEnvironmentVariables.length} missing environment variables`);
|
||||
const errorMessage = `AgHandler with slug '${this.slug}': The missing env Varibles are ${missingEnvironmentVariables}`;
|
||||
console.log(errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
constructor(agEnvironmentArg: AgEnvironment) {
|
||||
this.agEnvironment = agEnvironmentArg;
|
||||
}
|
||||
|
@ -6,6 +6,13 @@ import * as typedrequest from '@apiglobal/typedrequest';
|
||||
|
||||
export { typedrequest };
|
||||
|
||||
// pushrocks scope
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
|
||||
export {
|
||||
smartfile
|
||||
};
|
||||
|
||||
// @tsclass scope
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
|
Reference in New Issue
Block a user