mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 16:26:16 +00:00
requested changes
This commit is contained in:
@@ -2,7 +2,7 @@ import fastifyMultipart from "@fastify/multipart";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { readLimit } from "@app/server/config/rateLimiter";
|
import { writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { VaultMappingType } from "@app/services/external-migration/external-migration-types";
|
import { VaultMappingType } from "@app/services/external-migration/external-migration-types";
|
||||||
@@ -17,7 +17,7 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProvider
|
|||||||
bodyLimit: MB25_IN_BYTES,
|
bodyLimit: MB25_IN_BYTES,
|
||||||
url: "/env-key",
|
url: "/env-key",
|
||||||
config: {
|
config: {
|
||||||
rateLimit: readLimit
|
rateLimit: writeLimit
|
||||||
},
|
},
|
||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
handler: async (req) => {
|
handler: async (req) => {
|
||||||
@@ -59,7 +59,7 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProvider
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/vault",
|
url: "/vault",
|
||||||
config: {
|
config: {
|
||||||
rateLimit: readLimit
|
rateLimit: writeLimit
|
||||||
},
|
},
|
||||||
schema: {
|
schema: {
|
||||||
body: z.object({
|
body: z.object({
|
||||||
|
|||||||
@@ -45,16 +45,19 @@ export const useImportVault = () => {
|
|||||||
mutationFn: async ({
|
mutationFn: async ({
|
||||||
vaultAccessToken,
|
vaultAccessToken,
|
||||||
vaultNamespace,
|
vaultNamespace,
|
||||||
vaultUrl
|
vaultUrl,
|
||||||
|
mappingType
|
||||||
}: {
|
}: {
|
||||||
vaultAccessToken: string;
|
vaultAccessToken: string;
|
||||||
vaultNamespace: string;
|
vaultNamespace: string;
|
||||||
vaultUrl: string;
|
vaultUrl: string;
|
||||||
|
mappingType: string;
|
||||||
}) => {
|
}) => {
|
||||||
await apiRequest.post("/api/v3/external-migration/vault/", {
|
await apiRequest.post("/api/v3/external-migration/vault/", {
|
||||||
vaultAccessToken,
|
vaultAccessToken,
|
||||||
vaultNamespace,
|
vaultNamespace,
|
||||||
vaultUrl
|
vaultUrl,
|
||||||
|
mappingType
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import { AnimatePresence, motion } from "framer-motion";
|
|||||||
import { Modal, ModalContent } from "@app/components/v2";
|
import { Modal, ModalContent } from "@app/components/v2";
|
||||||
|
|
||||||
import { EnvKeyPlatformModal } from "./EnvKeyPlatformModal";
|
import { EnvKeyPlatformModal } from "./EnvKeyPlatformModal";
|
||||||
import { VaultPlatformModal } from "./VaultPlatformModal copy";
|
import { VaultPlatformModal } from "./VaultPlatformModal";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
|
|||||||
+2
-7
@@ -69,8 +69,6 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
|
|||||||
});
|
});
|
||||||
type TFormData = z.infer<typeof formSchema>;
|
type TFormData = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
const fileUploadRef = useRef<HTMLInputElement>(null);
|
|
||||||
|
|
||||||
const { mutateAsync: importVault } = useImportVault();
|
const { mutateAsync: importVault } = useImportVault();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -87,7 +85,8 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
|
|||||||
await importVault({
|
await importVault({
|
||||||
vaultAccessToken: data.vaultAccessToken,
|
vaultAccessToken: data.vaultAccessToken,
|
||||||
vaultNamespace: data.vaultNamespace,
|
vaultNamespace: data.vaultNamespace,
|
||||||
vaultUrl: data.vaultUrl
|
vaultUrl: data.vaultUrl,
|
||||||
|
mappingType: data.mappingType
|
||||||
});
|
});
|
||||||
createNotification({
|
createNotification({
|
||||||
title: "Import started",
|
title: "Import started",
|
||||||
@@ -97,10 +96,6 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
|
|||||||
|
|
||||||
onClose();
|
onClose();
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
if (fileUploadRef.current) {
|
|
||||||
fileUploadRef.current.value = "";
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user