platformservice/ts/classes.platformservicedb.ts

28 lines
945 B
TypeScript
Raw Normal View History

2024-02-16 12:28:40 +00:00
import * as plugins from './plugins.js';
2024-02-15 19:30:38 +00:00
import { SzPlatformService } from './classes.platformservice.js';
export class PlatformServiceDb {
public smartdataDb: plugins.smartdata.SmartdataDb;
public platformserviceRef: SzPlatformService;
constructor(platformserviceRefArg: SzPlatformService) {
this.platformserviceRef = platformserviceRefArg;
}
public async start() {
this.smartdataDb = new plugins.smartdata.SmartdataDb({
mongoDbUser: await this.platformserviceRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_USER'),
mongoDbName: await this.platformserviceRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_NAME'),
mongoDbPass: await this.platformserviceRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_PASS'),
mongoDbUrl: await this.platformserviceRef.serviceQenv.getEnvVarOnDemand('MONGO_DB_URL'),
});
await this.smartdataDb.init();
}
public async stop() {
await this.smartdataDb.close();
}
}