platformservice/ts/aibridge/aibridge.classes.aibridgedb.ts
2024-03-19 18:37:24 +01:00

26 lines
864 B
TypeScript

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();
}
}