import { useEffect, useRef, useState } from "react"; import Head from "next/head"; import { useRouter } from "next/router"; import { faCheck, faPlus } from "@fortawesome/free-solid-svg-icons"; import Button from "~/components/basic/buttons/Button"; import AddServiceTokenDialog from "~/components/basic/dialog/AddServiceTokenDialog"; import InputField from "~/components/basic/InputField"; import ServiceTokenTable from "~/components/basic/table/ServiceTokenTable"; import NavHeader from "~/components/navigation/NavHeader"; import getServiceTokens from "../../api/serviceToken/getServiceTokens"; import deleteWorkspace from "../../api/workspace/deleteWorkspace"; import getWorkspaces from "../../api/workspace/getWorkspaces"; import renameWorkspace from "../../api/workspace/renameWorkspace"; export default function SettingsBasic() { const [buttonReady, setButtonReady] = useState(false); const router = useRouter(); const [workspaceName, setWorkspaceName] = useState(""); const [serviceTokens, setServiceTokens] = useState([]); const [workspaceToBeDeletedName, setWorkspaceToBeDeletedName] = useState(""); const [workspaceId, setWorkspaceId] = useState(""); const [isAddOpen, setIsAddOpen] = useState(false); let [isAddServiceTokenDialogOpen, setIsAddServiceTokenDialogOpen] = useState(false); useEffect(async () => { let userWorkspaces = await getWorkspaces(); userWorkspaces.map((userWorkspace) => { if (userWorkspace._id == router.query.id) { setWorkspaceName(userWorkspace.name); } }); let tempServiceTokens = await getServiceTokens({ workspaceId: router.query.id, }); setServiceTokens(tempServiceTokens); }, []); const modifyWorkspaceName = (newName) => { setButtonReady(true); setWorkspaceName(newName); }; const submitChanges = (newWorkspaceName) => { renameWorkspace(router.query.id, newWorkspaceName); setButtonReady(false); }; useEffect(async () => { setWorkspaceId(router.query.id); }, []); function closeAddModal() { setIsAddOpen(false); } function openAddModal() { setIsAddOpen(true); } const closeAddServiceTokenModal = () => { setIsAddServiceTokenDialogOpen(false); }; /** * This function deleted a workspace. * It first checks if there is more than one workspace aviable. Otherwise, it doesn't delete * It then checks if the name of the workspace to be deleted is correct. Otherwise, it doesn't delete. * It then deletes the workspace and forwards the user to another aviable workspace. */ const executeDeletingWorkspace = async () => { let userWorkspaces = await getWorkspaces(); if (userWorkspaces.length > 1) { if ( userWorkspaces.filter( (workspace) => workspace._id == router.query.id )[0].name == workspaceToBeDeletedName ) { await deleteWorkspace(router.query.id); let userWorkspaces = await getWorkspaces(); router.push("/dashboard/" + userWorkspaces[0]._id); } } }; return (
Project Settings
These settings only apply to the currently selected Project.
Display Name
Project ID
To integrate Infisical into your code base and get automatic injection of environmental variables, you should use the following Project ID.
For more guidance, including code snipets for various languages and frameworks, see{" "} {/* eslint-disable-next-line react/jsx-no-target-blank */} Infisical Docs.
Service Tokens
Every service token is specific to you, a certain project and a certain environment within this project.
Project Environments
Choose which environments will show up in your Dashboard. Some common ones include Development, Staging, and Production. Often, teams choose to add Testing.
Note: the text in brackets shows how these environmant should be accessed in CLI.
Danger Zone
As soon as you delete this project, you will not be able to undo it. This will immediately remove all the keys. If you still want to do that, please enter the name of the project below.
Note: You can only delete a project in case you have more than one.