From ed14df894557a248b4dc958f13fd353d3163edb2 Mon Sep 17 00:00:00 2001 From: Josh Wulf Date: Thu, 25 Jul 2024 18:37:15 +1200 Subject: [PATCH] feat(zeebe): add support for ZEEBE_INSECURE_CONNECTION env var add support for ZEEBE_INSECURE_CONNECTION env var to disable TLS on the Zeebe gRPC connection --- src/__tests__/config/jest.cleanup.ts | 1 + src/lib/Configuration.ts | 5 +++++ src/zeebe/zb/ZeebeGrpcClient.ts | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/__tests__/config/jest.cleanup.ts b/src/__tests__/config/jest.cleanup.ts index 2bdfb119..80bdccf1 100644 --- a/src/__tests__/config/jest.cleanup.ts +++ b/src/__tests__/config/jest.cleanup.ts @@ -67,6 +67,7 @@ export const cleanUp = async () => { await zeebe.cancelProcessInstance(key) console.log(`Cancelled process instance ${key}`) } catch (e) { + console.log(e) if (!(e as Error).message.startsWith('5 NOT_FOUND')) { console.log('Failed to cancel process instance', key) console.log((e as Error).message) diff --git a/src/lib/Configuration.ts b/src/lib/Configuration.ts index 73476b42..6ec78da1 100644 --- a/src/lib/Configuration.ts +++ b/src/lib/Configuration.ts @@ -192,6 +192,11 @@ const getMainEnv = () => const getZeebeEnv = () => createEnv({ + ZEEBE_INSECURE_CONNECTION: { + type: 'boolean', + optional: true, + default: false, + }, /** Log level of Zeebe Client and Workers - 'DEBUG' | 'INFO' | 'NONE'. Defaults to 'INFO' */ ZEEBE_CLIENT_LOG_LEVEL: { type: 'string', diff --git a/src/zeebe/zb/ZeebeGrpcClient.ts b/src/zeebe/zb/ZeebeGrpcClient.ts index 5b18238b..69324550 100644 --- a/src/zeebe/zb/ZeebeGrpcClient.ts +++ b/src/zeebe/zb/ZeebeGrpcClient.ts @@ -155,7 +155,9 @@ export class ZeebeGrpcClient extends TypedEmitter< this.maxRetryTimeout = Duration.seconds.of( config.zeebeGrpcSettings.ZEEBE_GRPC_CLIENT_MAX_RETRY_TIMEOUT_SECONDS ) - this.useTLS = config.CAMUNDA_SECURE_CONNECTION + this.useTLS = + config.CAMUNDA_SECURE_CONNECTION && + !config.zeebeGrpcSettings.ZEEBE_INSECURE_CONNECTION const certChainPath = config.CAMUNDA_CUSTOM_CERT_CHAIN_PATH const privateKeyPath = config.CAMUNDA_CUSTOM_PRIVATE_KEY_PATH