mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 16:40:30 +00:00
Support for namespaces (for HCP)
This commit is contained in:
@@ -11,6 +11,7 @@ export type THCVaultConnection = TRootAppConnection & { app: AppConnection.HCVau
|
||||
method: HCVaultConnectionMethod.AccessToken;
|
||||
credentials: {
|
||||
instanceUrl: string;
|
||||
namespace?: string;
|
||||
accessToken: string;
|
||||
};
|
||||
}
|
||||
@@ -18,6 +19,7 @@ export type THCVaultConnection = TRootAppConnection & { app: AppConnection.HCVau
|
||||
method: HCVaultConnectionMethod.AppRole;
|
||||
credentials: {
|
||||
instanceUrl: string;
|
||||
namespace?: string;
|
||||
roleId: string;
|
||||
secretId: string;
|
||||
};
|
||||
|
||||
+21
@@ -35,11 +35,14 @@ const InstanceUrlSchema = z
|
||||
.min(1, "Instance URL required")
|
||||
.url("Invalid Instance URL");
|
||||
|
||||
const NamespaceSchema = z.string().trim().optional();
|
||||
|
||||
const formSchema = z.discriminatedUnion("method", [
|
||||
rootSchema.extend({
|
||||
method: z.literal(HCVaultConnectionMethod.AccessToken),
|
||||
credentials: z.object({
|
||||
instanceUrl: InstanceUrlSchema,
|
||||
namespace: NamespaceSchema,
|
||||
accessToken: z.string().trim().min(1, "Access Token required")
|
||||
})
|
||||
}),
|
||||
@@ -47,6 +50,7 @@ const formSchema = z.discriminatedUnion("method", [
|
||||
method: z.literal(HCVaultConnectionMethod.AppRole),
|
||||
credentials: z.object({
|
||||
instanceUrl: InstanceUrlSchema,
|
||||
namespace: NamespaceSchema,
|
||||
roleId: z.string().trim().min(1, "Role ID required"),
|
||||
secretId: z.string().trim().min(1, "Secret ID required")
|
||||
})
|
||||
@@ -127,6 +131,23 @@ export const HCVaultConnectionForm = ({ appConnection, onSubmit }: Props) => {
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="credentials.namespace"
|
||||
control={control}
|
||||
shouldUnregister
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="Namespace"
|
||||
isOptional
|
||||
tooltipClassName="max-w-sm"
|
||||
tooltipText="On self-hosted and enterprise clusters there may not be namespaces."
|
||||
>
|
||||
<Input {...field} placeholder="admin" />
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
{selectedMethod === HCVaultConnectionMethod.AccessToken ? (
|
||||
<Controller
|
||||
name="credentials.accessToken"
|
||||
|
||||
Reference in New Issue
Block a user