Skip to content

Commit

Permalink
Merge pull request #1022 from godspeedsystems/kafka-ssl
Browse files Browse the repository at this point in the history
feat: Add SSL configuration for Kafka connection
  • Loading branch information
kushal023 authored Jun 20, 2024
2 parents be043a6 + ee491f1 commit 60d1ded
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/core/validation/datasources/kafka.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
],
"minItems": 1
},
"ssl_key": {
"type": "string"
},
"ssl_cert": {
"type": "string"
},
"ssl_ca": {
"type": "string"
},
"reject": {
"type": "boolean"
},
"producer": {
"type": "object",
"properties": {
Expand Down
8 changes: 7 additions & 1 deletion src/kafka/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Consumer, Kafka, Producer, logLevel as kafkaLogLevel } from 'kafkajs';
import axios from 'axios';
import config from 'config';

import fs from 'fs';
import { GSActor, GSCloudEvent, GSStatus } from '../core/interfaces';
import { logger } from '../core/logger';

Expand Down Expand Up @@ -196,6 +196,12 @@ export default class KafkaMessageBus {

return brokers;
},
ssl: {
rejectUnauthorized: config.reject,
key: fs.readFileSync(config.ssl_key,'utf-8'),
cert: fs.readFileSync(config.ssl_cert,'utf-8'),
ca: [fs.readFileSync(config.ssl_ca,'utf-8')]
},
logCreator: pinoLogCreator
});

Expand Down

0 comments on commit 60d1ded

Please sign in to comment.