platformservice/ts/aibridge/aibridge.classes.aibridgedb.ts

26 lines
864 B
TypeScript
Raw Normal View History

2024-03-19 17:37:24 +00:00
import * as plugins from './aibridge.plugins.js';
import { AiBridge } from './aibridge.classes.aibridge.js';
export class AiBridgeDb {
public smartdataDb: plugins.smartdata.SmartdataDb;
public aibridgeRef: AiBridge;
constructor(aibridgeRefArg: AiBridge) {
this.aibridgeRef = aibridgeRefArg;
}
public async start() {
this.smartdataDb = new plugins.smartdata.SmartdataDb({
mongoDbUser: await this.aibridgeRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_USER'),
mongoDbName: await this.aibridgeRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_NAME'),
mongoDbPass: await this.aibridgeRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_PASS'),
mongoDbUrl: await this.aibridgeRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_URL'),
});
await this.smartdataDb.init();
}
public async stop() {
await this.smartdataDb.close();
}
}