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
+5
View File
@@ -3,6 +3,7 @@ import { SzSmsConnector } from './email/classes.smsconnector.js';
import * as plugins from './plugins.js';
export class SzPlatformClient {
public debugMode = false;
private authorizationString: string;
public typedrouter = new plugins.typedrequest.TypedRouter();
public typedsocket: plugins.typedsocket.TypedSocket;
@@ -19,6 +20,10 @@ export class SzPlatformClient {
if (authorizationStringArg) this.authorizationString = authorizationStringArg;
if (!this.authorizationString) this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION;
if (!this.authorizationString) throw new Error('authorizationString is required');
if (authorizationStringArg === 'test') {
this.debugMode = true;
return;
}
this.typedsocket = await plugins.typedsocket.TypedSocket.createClient(this.typedrouter, await this.getConnectionAddress());
}