32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
import { BusinessRecord } from './classes.businessrecord.js';
|
|
import { HandelsRegister } from './classes.handelsregister.js';
|
|
import { JsonlDataProcessor } from './classes.jsonldata.js';
|
|
import * as paths from './paths.js';
|
|
import * as plugins from './plugins.js';
|
|
|
|
export class OpenData {
|
|
public db: plugins.smartdata.SmartdataDb;
|
|
private serviceQenv = new plugins.qenv.Qenv(paths.packageDir, paths.nogitDir);
|
|
|
|
public jsonLDataProcessor: JsonlDataProcessor;
|
|
public handelsregister: HandelsRegister;
|
|
|
|
public CBusinessRecord = plugins.smartdata.setDefaultManagerForDoc(this, BusinessRecord);
|
|
|
|
public async start() {
|
|
this.db = new plugins.smartdata.SmartdataDb({
|
|
mongoDbUrl: await this.serviceQenv.getEnvVarOnDemand('MONGODB_URL'),
|
|
mongoDbName: await this.serviceQenv.getEnvVarOnDemand('MONGODB_NAME'),
|
|
mongoDbUser: await this.serviceQenv.getEnvVarOnDemand('MONGODB_USER'),
|
|
mongoDbPass: await this.serviceQenv.getEnvVarOnDemand('MONGODB_PASS'),
|
|
});
|
|
await this.db.init();
|
|
this.jsonLDataProcessor = new JsonlDataProcessor(this);
|
|
this.handelsregister = new HandelsRegister(this);
|
|
await this.handelsregister.start();
|
|
}
|
|
public async stop() {
|
|
await this.db.close();
|
|
await this.handelsregister.stop();
|
|
}
|
|
} |