Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: address requested changes

Scott Wilson1f2b0443cc3b
diff --git a/frontend/src/components/dashboard/DropZone.tsx b/frontend/src/components/dashboard/DropZone.tsx
index b196e8cd4b..ab246c377b 100644
--- a/frontend/src/components/dashboard/DropZone.tsx
+++ b/frontend/src/components/dashboard/DropZone.tsx
@@ -11,7 +11,7 @@ import { SecretType } from "@app/hooks/api/types";
import Button from "../basic/buttons/Button";
import Error from "../basic/Error";
import { createNotification } from "../notifications";
-import { parseDotEnv } from "../utilities/parseDotEnv";
+import { parseDotEnv } from "../utilities/parseSecrets";
import guidGenerator from "../utilities/randomId";
interface DropZoneProps {
diff --git a/frontend/src/components/utilities/parseJson.ts b/frontend/src/components/utilities/parseJson.ts
deleted file mode 100644
index e6eb36f80e..0000000000
--- a/frontend/src/components/utilities/parseJson.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export const parseJson = (src: ArrayBuffer | string) => {
- const file = src.toString();
- const formatedData: Record<string, string> = JSON.parse(file);
- const env: Record<string, { value: string; comments: string[] }> = {};
- Object.keys(formatedData).forEach((key) => {
- if (typeof formatedData[key] === "string") {
- env[key] = { value: formatedData[key], comments: [] };
- }
- });
- return env;
-};
diff --git a/frontend/src/components/utilities/parseDotEnv.ts b/frontend/src/components/utilities/parseSecrets.ts
similarity index 81%
rename from frontend/src/components/utilities/parseDotEnv.ts
rename to frontend/src/components/utilities/parseSecrets.ts
index ac9c616b55..d1df7cd687 100644
--- a/frontend/src/components/utilities/parseDotEnv.ts
+++ b/frontend/src/components/utilities/parseSecrets.ts
@@ -65,3 +65,15 @@ export function parseDotEnv(src: ArrayBuffer | string) {
return object;
}
+
+export const parseJson = (src: ArrayBuffer | string) => {
+ const file = src.toString();
+ const formatedData: Record<string, string> = JSON.parse(file);
+ const env: Record<string, { value: string; comments: string[] }> = {};
+ Object.keys(formatedData).forEach((key) => {
+ if (typeof formatedData[key] === "string") {
+ env[key] = { value: formatedData[key], comments: [] };
+ }
+ });
+ return env;
+};
diff --git a/frontend/src/views/SecretMainPage/components/SecretDropzone/PasteSecretEnvModal.tsx b/frontend/src/views/SecretMainPage/components/SecretDropzone/PasteSecretEnvModal.tsx
index da4be83014..718bf7f1c6 100644
--- a/frontend/src/views/SecretMainPage/components/SecretDropzone/PasteSecretEnvModal.tsx
+++ b/frontend/src/views/SecretMainPage/components/SecretDropzone/PasteSecretEnvModal.tsx
@@ -6,8 +6,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { parseDotEnv } from "@app/components/utilities/parseDotEnv";
-import { parseJson } from "@app/components/utilities/parseJson";
+import { parseDotEnv, parseJson } from "@app/components/utilities/parseSecrets";
import {
Button,
FormControl,
@@ -111,7 +110,7 @@ export const PasteSecretEnvModal = ({
variant="star"
size={isSmaller ? "xs" : "sm"}
>
- Paste Secret Values
+ Paste Secrets
</Button>
)}
</ProjectPermissionCan>
diff --git a/frontend/src/views/SecretMainPage/components/SecretDropzone/SecretDropzone.tsx b/frontend/src/views/SecretMainPage/components/SecretDropzone/SecretDropzone.tsx
index 017fce7fa0..f105a08a51 100644
--- a/frontend/src/views/SecretMainPage/components/SecretDropzone/SecretDropzone.tsx
+++ b/frontend/src/views/SecretMainPage/components/SecretDropzone/SecretDropzone.tsx
@@ -9,8 +9,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
// TODO:(akhilmhdh) convert all the util functions like this into a lib folder grouped by functionality
-import { parseDotEnv } from "@app/components/utilities/parseDotEnv";
-import { parseJson } from "@app/components/utilities/parseJson";
+import { parseDotEnv, parseJson } from "@app/components/utilities/parseSecrets";
import { Button, Modal, ModalContent } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { usePopUp, useToggle } from "@app/hooks";