Skip to content

Commit

Permalink
Merge pull request #7 from gschmutz/non-secure-kafka-fix
Browse files Browse the repository at this point in the history
Support for sending feed to non-secure kafka cluster: sasl-mechanism flag optional and ssl default to false
  • Loading branch information
sdairs authored Jan 8, 2025
2 parents ebe1808 + 1c0f368 commit 25bfe0d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions apps/cli/src/commands/start/kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default class StartKafka extends BaseStartCommand<typeof StartKafka> {
'sasl-mechanism': Flags.string({
description: 'SASL mechanism',
options: ['plain', 'scram-sha-256', 'scram-sha-512'],
default: 'plain',
char: 'm',
dependsOn: ['username', 'password'],
}),
Expand All @@ -54,22 +53,26 @@ export default class StartKafka extends BaseStartCommand<typeof StartKafka> {
ssl: Flags.boolean({
description: 'Enable SSL',
char: 's',
default: true,
default: false,
}),
};

protected createDestination(flags: Record<string, any>): Destination {
const config: KafkaConfig = {
brokers: flags.brokers.split(','),
clientId: flags['client-id'],
sasl: {
mechanism: flags['sasl-mechanism'].toLowerCase(),
username: flags.username,
password: flags.password,
},
ssl: flags.ssl,
};

if (flags['sasl-mechanism'] !== undefined) {
config.sasl = {
mechanism: flags['sasl-mechanism'].toLowerCase(),
username: flags.username,
password: flags.password,
};
}

return new KafkaDestination(config, flags.topic);
}

}

0 comments on commit 25bfe0d

Please sign in to comment.