Skip to content

Instantly share code, notes, and snippets.

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