platformservice/ts/platformservice.ts
2025-05-07 20:20:17 +00:00

38 lines
1.3 KiB
TypeScript

import * as plugins from './plugins.js';
import * as paths from './paths.js';
import { PlatformServiceDb } from './classes.platformservicedb.js'
import { EmailService } from './email/classes.emailservice.js';
import { SmsService } from './sms/classes.smsservice.js';
import { MtaService } from './mta/classes.mta.js';
export class SzPlatformService {
public projectinfo: plugins.projectinfo.ProjectInfo;
public serviceQenv = new plugins.qenv.Qenv('./', './.nogit');
public platformserviceDb: PlatformServiceDb;
public typedserver: plugins.typedserver.TypedServer;
public typedrouter = new plugins.typedrequest.TypedRouter();
// SubServices
public emailService: EmailService;
public mtaService: MtaService;
public smsService: SmsService;
public async start() {
this.platformserviceDb = new PlatformServiceDb(this);
this.projectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
// lets start the sub services
this.emailService = new EmailService(this);
this.mtaService = new MtaService(this);
this.smsService = new SmsService(this, {
apiGatewayApiToken: await this.serviceQenv.getEnvVarOnDemand('SMS_API_TOKEN'),
});
// lets start the server finally
this.typedserver = new plugins.typedserver.TypedServer({
cors: true,
});
await this.typedserver.start();
}
}