fix(core): Fix authorization handling and format code.
This commit is contained in:
@@ -21,18 +21,25 @@ export class SzPlatformClient {
|
||||
}
|
||||
|
||||
public async init(authorizationStringArg?: string) {
|
||||
if (authorizationStringArg) this.authorizationString = authorizationStringArg;
|
||||
if (!this.authorizationString) this.authorizationString = process.env.SERVEZONE_PLATFROM_AUTHORIZATION;
|
||||
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') {
|
||||
if (this.authorizationString === 'test') {
|
||||
this.debugMode = true;
|
||||
console.log('debug mode activated.');
|
||||
return;
|
||||
}
|
||||
this.typedsocket = await plugins.typedsocket.TypedSocket.createClient(this.typedrouter, await this.getConnectionAddress());
|
||||
this.typedsocket = await plugins.typedsocket.TypedSocket.createClient(
|
||||
this.typedrouter,
|
||||
await this.getConnectionAddress()
|
||||
);
|
||||
}
|
||||
|
||||
private async getConnectionAddress() {
|
||||
const connectionAddress = await this.qenvInstance.getEnvVarOnDemand('SERVEZONE_API_DOMAIN');
|
||||
return connectionAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user