mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-20 05:15:23 +02:00
refactor(templates): remove legacy template files and update project structure
- Delete all template-related files in `apps/dokploy/templates` - Remove template image files from `apps/dokploy/public/templates` - Update server-side template processing with new implementation - Clean up unused configuration and utility files
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import type { Domain } from "@dokploy/server";
|
||||
// import { IS_CLOUD } from "@/server/constants";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { templates } from "../templates";
|
||||
import type { TemplatesKeys } from "../types/templates-data.type";
|
||||
|
||||
export interface Schema {
|
||||
serverIp: string;
|
||||
@@ -58,28 +52,3 @@ export const generatePassword = (quantity = 16): string => {
|
||||
export const generateBase64 = (bytes = 32): string => {
|
||||
return randomBytes(bytes).toString("base64");
|
||||
};
|
||||
|
||||
export const loadTemplateModule = async (
|
||||
id: TemplatesKeys,
|
||||
): Promise<(schema: Schema) => Template> => {
|
||||
const templateLoader = templates.find((t) => t.id === id);
|
||||
if (!templateLoader) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: `Template ${id} not found or not implemented yet`,
|
||||
});
|
||||
}
|
||||
|
||||
const generate = await templateLoader.load();
|
||||
return generate;
|
||||
};
|
||||
|
||||
export const readTemplateComposeFile = async (id: string) => {
|
||||
const cwd = process.cwd();
|
||||
const composeFile = await readFile(
|
||||
join(cwd, ".next", "templates", id, "docker-compose.yml"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
return composeFile;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user