Created
February 29, 2020 17:03
-
-
Save jwulf/19ed3181415f5de5870655ff6df4084a 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) | |
return new GrpcMiddleware({ profile, config }).getGrpcClient() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment