mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-08 23:18:05 -05:00
Remove username pwd in redis resource
This commit is contained in:
@@ -46,8 +46,6 @@ const makeRedisConnection = (
|
||||
): RedisResourceConnection => {
|
||||
const { connectionDetails, username, password } = config;
|
||||
const { sslEnabled, sslRejectUnauthorized, sslCertificate } = connectionDetails;
|
||||
const actualUsername = username ?? connectionDetails.username ?? TEST_CONNECTION_USERNAME;
|
||||
const actualPassword = password ?? connectionDetails.password ?? TEST_CONNECTION_PASSWORD;
|
||||
|
||||
let client: Redis | null = null;
|
||||
|
||||
@@ -55,8 +53,6 @@ const makeRedisConnection = (
|
||||
return new Redis({
|
||||
host: "localhost",
|
||||
port: proxyPort,
|
||||
username: actualUsername,
|
||||
password: actualPassword,
|
||||
connectTimeout: EXTERNAL_REQUEST_TIMEOUT,
|
||||
commandTimeout: EXTERNAL_REQUEST_TIMEOUT,
|
||||
...(sslEnabled && {
|
||||
@@ -75,14 +71,6 @@ const makeRedisConnection = (
|
||||
validate: async (connectOnly) => {
|
||||
try {
|
||||
client = createClient();
|
||||
|
||||
// Test authentication
|
||||
const result = await client.auth(actualUsername, actualPassword);
|
||||
if (result !== "OK") {
|
||||
throw new BadRequestError({ message: `Redis authentication failed: ${result as string}` });
|
||||
}
|
||||
|
||||
// Test connection with a simple command
|
||||
await client.ping();
|
||||
} catch (error) {
|
||||
if (connectOnly) {
|
||||
|
||||
@@ -15,8 +15,6 @@ import {
|
||||
export const RedisResourceConnectionDetailsSchema = z.object({
|
||||
host: z.string().trim().min(1).max(255),
|
||||
port: z.coerce.number(),
|
||||
username: z.string().trim().min(1).max(63).optional(),
|
||||
password: z.string().trim().max(256).optional(),
|
||||
sslEnabled: z.boolean(),
|
||||
sslRejectUnauthorized: z.boolean(),
|
||||
sslCertificate: z
|
||||
|
||||
@@ -6,8 +6,8 @@ import { z } from "zod";
|
||||
import { Button, ModalClose } from "@app/components/v2";
|
||||
import { PamResourceType, TRedisResource } from "@app/hooks/api/pam";
|
||||
|
||||
import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
|
||||
import { RedisResourceFields } from "./shared/RedisResourceFields";
|
||||
import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
|
||||
|
||||
type Props = {
|
||||
resource?: TRedisResource;
|
||||
@@ -19,8 +19,6 @@ const formSchema = genericResourceFieldsSchema.extend({
|
||||
connectionDetails: z.object({
|
||||
host: z.string().trim().min(1, "Host required"),
|
||||
port: z.coerce.number().default(6379),
|
||||
username: z.string().trim().optional(),
|
||||
password: z.string().trim().optional(),
|
||||
sslEnabled: z.boolean().default(true),
|
||||
sslRejectUnauthorized: z.boolean().default(true),
|
||||
sslCertificate: z
|
||||
@@ -44,8 +42,6 @@ export const RedisResourceForm = ({ resource, onSubmit }: Props) => {
|
||||
connectionDetails: {
|
||||
host: "",
|
||||
port: 6379,
|
||||
username: undefined,
|
||||
password: undefined,
|
||||
sslEnabled: true,
|
||||
sslRejectUnauthorized: true,
|
||||
sslCertificate: undefined
|
||||
|
||||
@@ -69,38 +69,6 @@ export const RedisResourceFields = ({ setSelectedTabIndex, selectedTabIndex }: P
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-4 flex items-start gap-2">
|
||||
<Controller
|
||||
name="connectionDetails.username"
|
||||
control={control}
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
className="flex-1"
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="Username"
|
||||
isOptional
|
||||
>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="connectionDetails.password"
|
||||
control={control}
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
className="flex-1"
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="Password"
|
||||
isOptional
|
||||
>
|
||||
<Input type="password" {...field} />
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Tab.Panel>
|
||||
<Tab.Panel>
|
||||
<Controller
|
||||
|
||||
Reference in New Issue
Block a user