diff --git a/apps/dokploy/components/dashboard/projects/add-env.tsx b/apps/dokploy/components/dashboard/projects/project-enviroment.tsx similarity index 74% rename from apps/dokploy/components/dashboard/projects/add-env.tsx rename to apps/dokploy/components/dashboard/projects/project-enviroment.tsx index 79870ebbc..7dd9737c2 100644 --- a/apps/dokploy/components/dashboard/projects/add-env.tsx +++ b/apps/dokploy/components/dashboard/projects/project-enviroment.tsx @@ -19,11 +19,9 @@ import { FormLabel, FormMessage, } from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { Textarea } from "@/components/ui/textarea"; import { api } from "@/utils/api"; import { zodResolver } from "@hookform/resolvers/zod"; -import { AlertTriangle, FileIcon, SquarePen } from "lucide-react"; +import { FileIcon } from "lucide-react"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -37,9 +35,10 @@ type UpdateProject = z.infer; interface Props { projectId: string; + children?: React.ReactNode; } -export const AddEnv = ({ projectId }: Props) => { +export const ProjectEnviroment = ({ projectId, children }: Props) => { const [isOpen, setIsOpen] = useState(false); const utils = api.useUtils(); const { mutateAsync, error, isError, isLoading } = @@ -53,7 +52,6 @@ export const AddEnv = ({ projectId }: Props) => { }, ); - console.log(data); const form = useForm({ defaultValues: { env: data?.env ?? "", @@ -86,34 +84,29 @@ export const AddEnv = ({ projectId }: Props) => { return ( - e.preventDefault()} - > - - Add Env - + {children ?? ( + e.preventDefault()} + > + + Project Enviroment + + )} - Modify Shared Env - Update the env variables + Project Enviroment + + Update the env Environment variables that are accessible to all + services of this project. Use this syntax to reference project-level + variables in your service environments: + {isError && {error?.message}} - To use a shared env, in one of your services, you need to use like - this: Let's say you have a shared env ENVIROMENT="development" and you - want to use it in your service, you need to use like this: -
    -
  • - ENVIRONMENT=${"{{project.ENVIRONMENT}}"} -
  • -
  • - DATABASE_URL=${"{{project.DATABASE_URL}}"} -
  • -
{" "} - This allows the service to inherit and use the shared variables from - the project level, ensuring consistency across services. + Use this syntax to reference project-level variables in your service + environments: DATABASE_URL=${"{{project.DATABASE_URL}}"}
diff --git a/apps/dokploy/components/dashboard/projects/show.tsx b/apps/dokploy/components/dashboard/projects/show.tsx index 275f9380d..92fc337f5 100644 --- a/apps/dokploy/components/dashboard/projects/show.tsx +++ b/apps/dokploy/components/dashboard/projects/show.tsx @@ -25,7 +25,6 @@ import { api } from "@/utils/api"; import { AlertTriangle, BookIcon, - CircuitBoard, ExternalLink, ExternalLinkIcon, FolderInput, @@ -35,7 +34,7 @@ import { import Link from "next/link"; import { Fragment } from "react"; import { toast } from "sonner"; -import { AddEnv } from "./add-env"; +import { ProjectEnviroment } from "./project-enviroment"; import { UpdateProject } from "./update"; export const ShowProjects = () => { @@ -192,7 +191,9 @@ export const ShowProjects = () => { Actions
e.stopPropagation()}> - +
e.stopPropagation()}> diff --git a/apps/dokploy/components/dashboard/settings/servers/show-servers.tsx b/apps/dokploy/components/dashboard/settings/servers/show-servers.tsx index 7d41d7fcf..c9e19c10e 100644 --- a/apps/dokploy/components/dashboard/settings/servers/show-servers.tsx +++ b/apps/dokploy/components/dashboard/settings/servers/show-servers.tsx @@ -98,7 +98,7 @@ export const ShowServers = () => { ) )} {data && data?.length > 0 && ( -
+
See all servers diff --git a/apps/dokploy/pages/dashboard/project/[projectId].tsx b/apps/dokploy/pages/dashboard/project/[projectId].tsx index afbd25906..82b43ae55 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId].tsx @@ -2,6 +2,7 @@ import { AddApplication } from "@/components/dashboard/project/add-application"; import { AddCompose } from "@/components/dashboard/project/add-compose"; import { AddDatabase } from "@/components/dashboard/project/add-database"; import { AddTemplate } from "@/components/dashboard/project/add-template"; +import { ProjectEnviroment } from "@/components/dashboard/projects/project-enviroment"; import { MariadbIcon, MongodbIcon, @@ -198,27 +199,35 @@ const Project = ( {(auth?.rol === "admin" || user?.canCreateServices) && ( - - - - - - - Actions - - - - - - - - +
+ + + + + + + + + + Actions + + + + + + + + +
)}