Skip to content

Commit

Permalink
Kafka: username optional, if not supplied no auth used
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Mar 18, 2024
1 parent 7cd117a commit b2bb58a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions ui/app/peers/create/[peerType]/helpers/ch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const clickhouseSetting: PeerSetting[] = [
setter((curr) => ({ ...curr, disableTls: value as boolean })),
type: 'switch',
tips: 'If you are using a non-TLS connection for Clickhouse server, check this box.',
optional: true,
},
{
label: 'S3 Path',
Expand Down
3 changes: 3 additions & 0 deletions ui/app/peers/create/[peerType]/helpers/ka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export const kaSetting: PeerSetting[] = [
label: 'Username',
stateHandler: (value, setter) =>
setter((curr) => ({ ...curr, username: value as string })),
optional: true,
},
{
label: 'Password',
type: 'password',
stateHandler: (value, setter) =>
setter((curr) => ({ ...curr, password: value as string })),
optional: true,
},
{
label: 'SASL Mechanism',
Expand All @@ -35,6 +37,7 @@ export const kaSetting: PeerSetting[] = [
setter((curr) => ({ ...curr, disableTls: value as boolean })),
type: 'switch',
tips: 'If you are using a non-TLS connection for Kafka server, check this box.',
optional: true,
},
];

Expand Down
12 changes: 5 additions & 7 deletions ui/app/peers/create/[peerType]/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,11 @@ export const chSchema = z.object({
});

export const kaSchema = z.object({
servers: z.array(z.string()).min(1, { message: 'Atleast 1 server required' }),
username: z
.string({ required_error: 'Username is required' })
.min(1, { message: 'Username cannot be empty' }),
password: z
.string({ required_error: 'Password is required' })
.min(1, { message: 'Password cannot be empty' }),
servers: z
.array(z.string({ required_error: 'Server address must not be empty' }))
.min(1, { message: 'At least 1 server required' }),
username: z.string().optional(),
password: z.string().optional(),
sasl: z
.union(
[
Expand Down
1 change: 0 additions & 1 deletion ui/components/PeerForms/KafkaConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const saslOptions = [
const KafkaForm = ({ setter }: KafkaProps) => {
return (
<div>
<Label>TODO TEXT</Label>
{kaSetting.map((setting, index) => {
return setting.type === 'switch' ? (
<RowWithSwitch
Expand Down

0 comments on commit b2bb58a

Please sign in to comment.