mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-17 17:35:17 +00:00
Merge pull request #2717 from Omar125X/fix/domain-validation
fix: improve domain and letsencrypt email validation
This commit is contained in:
@@ -36,7 +36,7 @@ import { api } from "@/utils/api";
|
|||||||
|
|
||||||
const addServerDomain = z
|
const addServerDomain = z
|
||||||
.object({
|
.object({
|
||||||
domain: z.string(),
|
domain: z.string().trim().toLowerCase(),
|
||||||
letsEncryptEmail: z.string(),
|
letsEncryptEmail: z.string(),
|
||||||
https: z.boolean().optional(),
|
https: z.boolean().optional(),
|
||||||
certificateType: z.enum(["letsencrypt", "none", "custom"]),
|
certificateType: z.enum(["letsencrypt", "none", "custom"]),
|
||||||
@@ -49,7 +49,11 @@ const addServerDomain = z
|
|||||||
message: "Required",
|
message: "Required",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (data.certificateType === "letsencrypt" && !data.letsEncryptEmail) {
|
if (
|
||||||
|
data.https &&
|
||||||
|
data.certificateType === "letsencrypt" &&
|
||||||
|
!data.letsEncryptEmail
|
||||||
|
) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message:
|
message:
|
||||||
|
|||||||
@@ -225,9 +225,7 @@ export const settingsRouter = createTRPCRouter({
|
|||||||
}
|
}
|
||||||
const user = await updateUser(ctx.user.ownerId, {
|
const user = await updateUser(ctx.user.ownerId, {
|
||||||
host: input.host,
|
host: input.host,
|
||||||
...(input.letsEncryptEmail && {
|
letsEncryptEmail: input.letsEncryptEmail,
|
||||||
letsEncryptEmail: input.letsEncryptEmail,
|
|
||||||
}),
|
|
||||||
certificateType: input.certificateType,
|
certificateType: input.certificateType,
|
||||||
https: input.https,
|
https: input.https,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ const { handler, api } = betterAuth({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(user);
|
|
||||||
|
|
||||||
if (IS_CLOUD) {
|
if (IS_CLOUD) {
|
||||||
try {
|
try {
|
||||||
const hutk = getHubSpotUTK(
|
const hutk = getHubSpotUTK(
|
||||||
|
|||||||
@@ -23,11 +23,18 @@ export const updateServerTraefik = (
|
|||||||
config.http.routers = config.http.routers || {};
|
config.http.routers = config.http.routers || {};
|
||||||
config.http.services = config.http.services || {};
|
config.http.services = config.http.services || {};
|
||||||
|
|
||||||
|
// Get or create router config, but always update the rule with newHost
|
||||||
const currentRouterConfig = config.http.routers[`${appName}-router-app`] || {
|
const currentRouterConfig = config.http.routers[`${appName}-router-app`] || {
|
||||||
rule: `Host(\`${newHost}\`)`,
|
|
||||||
service: `${appName}-service-app`,
|
service: `${appName}-service-app`,
|
||||||
entryPoints: ["web"],
|
entryPoints: ["web"],
|
||||||
|
rule: `Host(\`${newHost}\`)`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Always update the rule with the new host
|
||||||
|
if (newHost) {
|
||||||
|
currentRouterConfig.rule = `Host(\`${newHost}\`)`;
|
||||||
|
}
|
||||||
|
|
||||||
config.http.routers[`${appName}-router-app`] = currentRouterConfig;
|
config.http.routers[`${appName}-router-app`] = currentRouterConfig;
|
||||||
|
|
||||||
config.http.services = {
|
config.http.services = {
|
||||||
|
|||||||
Reference in New Issue
Block a user