From 702be4e9fb7685dacaa3a07c3b84fd17ead05fa7 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 17 Dec 2024 20:44:41 -0800 Subject: [PATCH] update kafka client config --- scripts/check-env.js | 9 +-------- src/lib/kafka.ts | 5 +++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/check-env.js b/scripts/check-env.js index 701e48c02..e8c80a5da 100644 --- a/scripts/check-env.js +++ b/scripts/check-env.js @@ -23,12 +23,5 @@ if (!process.env.SKIP_DB_CHECK && !process.env.DATABASE_TYPE) { } if (process.env.CLOUD_MODE) { - checkMissing([ - 'CLOUD_URL', - 'KAFKA_BROKER', - 'KAFKA_URL', - 'REDIS_URL', - 'KAFKA_SASL_MECHANISM', - 'KAFKA_SSL', - ]); + checkMissing(['CLOUD_URL', 'KAFKA_BROKER', 'KAFKA_URL', 'REDIS_URL', 'KAFKA_SASL_MECHANISM']); } diff --git a/src/lib/kafka.ts b/src/lib/kafka.ts index 1ac28a5bb..99fc323ac 100644 --- a/src/lib/kafka.ts +++ b/src/lib/kafka.ts @@ -12,13 +12,14 @@ const enabled = Boolean(process.env.KAFKA_URL && process.env.KAFKA_BROKER); function getClient() { const { username, password } = new URL(process.env.KAFKA_URL); const brokers = process.env.KAFKA_BROKER.split(','); - const sslEnabled = process.env.KAFKA_SSL.toLowerCase() === 'true'; const mechanism = process.env.KAFKA_SASL_MECHANISM as 'plain' | 'scram-sha-256' | 'scram-sha-512'; const ssl: { ssl?: tls.ConnectionOptions | boolean; sasl?: SASLOptions } = username && password ? { - ssl: sslEnabled, + ssl: { + rejectUnauthorized: false, + }, sasl: { mechanism, username,