diff --git a/__test__/traefik/traefik.test.ts b/__test__/traefik/traefik.test.ts index f6af400d..f10eefb3 100644 --- a/__test__/traefik/traefik.test.ts +++ b/__test__/traefik/traefik.test.ts @@ -63,8 +63,8 @@ const baseDomain: Domain = { domainId: "", host: "", https: false, - path: "", - port: 3000, + path: null, + port: null, uniqueConfigKey: 1, }; diff --git a/components/dashboard/application/domains/add-domain.tsx b/components/dashboard/application/domains/add-domain.tsx index 59cc05c3..b8ccae1c 100644 --- a/components/dashboard/application/domains/add-domain.tsx +++ b/components/dashboard/application/domains/add-domain.tsx @@ -37,11 +37,12 @@ const hostnameRegex = /^[a-zA-Z0-9][a-zA-Z0-9\.-]*\.[a-zA-Z]{2,}$/; const domain = z.object({ host: z.string().regex(hostnameRegex, { message: "Invalid hostname" }), - path: z.string().min(1), + path: z.string().min(1).nullable(), port: z .number() .min(1, { message: "Port must be at least 1" }) - .max(65535, { message: "Port must be 65535 or below" }), + .max(65535, { message: "Port must be 65535 or below" }) + .nullable(), https: z.boolean(), certificateType: z.enum(["letsencrypt", "none"]), }); diff --git a/server/db/schema/domain.ts b/server/db/schema/domain.ts index dad92090..3ceca6b5 100644 --- a/server/db/schema/domain.ts +++ b/server/db/schema/domain.ts @@ -13,8 +13,8 @@ export const domains = pgTable("domain", { .$defaultFn(() => nanoid()), host: text("host").notNull(), https: boolean("https").notNull().default(false), - port: integer("port").default(80).notNull(), - path: text("path").default("/").notNull(), + port: integer("port").default(80), + path: text("path").default("/"), uniqueConfigKey: serial("uniqueConfigKey"), createdAt: text("createdAt") .notNull()