feat(SzPlatformClient): Add debug mode functionality to SzPlatformClient and SzEmailConnector

This commit is contained in:
2024-10-04 13:39:41 +02:00
parent 965dad9b15
commit 7e721eb48e
4 changed files with 18 additions and 2 deletions

View File

@ -13,13 +13,18 @@ export class SzEmailConnector {
public async sendEmail(
optionsArg: plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail['request']
) {
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
if (this.platformClientRef.debugMode) {
logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to}
body:
${optionsArg.body.split('\n').map(line => ` ${line}`).join('\n')}
`);
}
if (this.platformClientRef.debugMode) {
return;
}
const typedRequest =
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
'sendEmail'