Skip to content

Instantly share code, notes, and snippets.

@jwulf
Last active February 29, 2020 16:51
Show Gist options
  • Save jwulf/7a41b260caf30cce7972739a0559ea03 to your computer and use it in GitHub Desktop.
Save jwulf/7a41b260caf30cce7972739a0559ea03 to your computer and use it in GitHub Desktop.
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