feat: add domains in external server

This commit is contained in:
Mauricio Siu
2024-09-09 09:35:02 -06:00
parent cf06162be7
commit 5afe1645a0
11 changed files with 207 additions and 19 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import type { Domain } from "@/server/api/services/domain";
import { TRPCError } from "@trpc/server";
import { templates } from "../templates";
import type { TemplatesKeys } from "../types/templates-data.type";
import { IS_CLOUD } from "@/server/constants";
export interface Schema {
serverIp: string;
@@ -28,7 +29,7 @@ export const generateRandomDomain = ({
}: Schema): string => {
const hash = randomBytes(3).toString("hex");
const slugIp = serverIp.replaceAll(".", "-");
return `${projectName}-${hash}${process.env.NODE_ENV === "production" ? `-${slugIp}` : ""}.traefik.me`;
return `${projectName}-${hash}${process.env.NODE_ENV === "production" || IS_CLOUD ? `-${slugIp}` : ""}.traefik.me`;
};
export const generateHash = (projectName: string, quantity = 3): string => {