Last active
February 29, 2020 16:51
-
-
Save jwulf/7a41b260caf30cce7972739a0559ea03 to your computer and use it in GitHub Desktop.
A code sample from the article https://joshwulf.com/blog/2020/03/camunda-cloud-connection-2/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class GrpcConnectionFactory { | |
private static autodetect(config: GrpcClientCtor): GrpcConnectionProfile { | |
const isCamundaCloud = config.host.includes('zeebe.camunda.io') | |
return isCamundaCloud ? 'CAMUNDA_CLOUD' : 'VANILLA' | |
} | |
public static getGrpcClient(config: GrpcClientCtor) { | |
const profile = GrpcConnectionFactory.autodetect(config) | |
const grpcClient = new GrpcClient(config) | |
new GrpcMiddleware({ profile, grpcClient }) | |
return new GrpcClient(config) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment