mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-16 11:25:24 +02:00
fix(settings): allow clearing the server domain
The Server Domain form rejected an empty value ('Invalid domain name'),
making domain assignment a one-way operation. The backend already
removes the Traefik router and clears the host when it receives an
empty host, so only the client-side validation blocked removal.
Allow an empty domain to clear it, and skip the https/letsencrypt
requirements when the domain is being removed.
Fixes #4821
This commit is contained in:
@@ -43,7 +43,8 @@ const addServerDomain = z
|
||||
.string()
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.refine((val) => VALID_HOSTNAME_REGEX.test(val), {
|
||||
// empty clears the server domain and reverts to IP-only access
|
||||
.refine((val) => val === "" || VALID_HOSTNAME_REGEX.test(val), {
|
||||
message: INVALID_HOSTNAME_MESSAGE,
|
||||
}),
|
||||
letsEncryptEmail: z.string(),
|
||||
@@ -51,7 +52,7 @@ const addServerDomain = z
|
||||
certificateType: z.enum(["letsencrypt", "none", "custom"]),
|
||||
})
|
||||
.superRefine((data, ctx) => {
|
||||
if (data.https && !data.certificateType) {
|
||||
if (data.domain && data.https && !data.certificateType) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
path: ["certificateType"],
|
||||
@@ -59,6 +60,7 @@ const addServerDomain = z
|
||||
});
|
||||
}
|
||||
if (
|
||||
data.domain &&
|
||||
data.https &&
|
||||
data.certificateType === "letsencrypt" &&
|
||||
!data.letsEncryptEmail
|
||||
|
||||
Reference in New Issue
Block a user