refactor: retrieve the correct names when adding a prefix

This commit is contained in:
Mauricio Siu
2024-09-03 23:22:24 -06:00
parent a3be030fac
commit 9c89208d83
4 changed files with 22 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ import { eq } from "drizzle-orm";
import { getDokployUrl } from "./admin";
import { createDeploymentCompose, updateDeploymentStatus } from "./deployment";
import { validUniqueServerAppName } from "./project";
import { randomizeSpecificationFile } from "@/server/utils/docker/compose";
export type Compose = typeof compose.$inferSelect;
@@ -117,7 +118,16 @@ export const loadServices = async (
await cloneCompose(compose);
}
const composeData = await loadDockerCompose(compose);
let composeData = await loadDockerCompose(compose);
if (compose.randomize && composeData) {
const randomizedCompose = randomizeSpecificationFile(
composeData,
compose.prefix,
);
composeData = randomizedCompose;
}
if (!composeData?.services) {
throw new TRPCError({
code: "NOT_FOUND",