Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const schema = z
previewPath: z.string(),
previewCertificateType: z.enum(["letsencrypt", "none", "custom"]),
previewCustomCertResolver: z.string().optional(),
useCustomEntrypoint: z.boolean(),
previewCustomEntrypoint: z.string().optional(),
previewRequireCollaboratorPermissions: z.boolean(),
})
.superRefine((input, ctx) => {
Expand All @@ -69,6 +71,14 @@ const schema = z
message: "Required",
});
}

if (input.useCustomEntrypoint && !input.previewCustomEntrypoint) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["previewCustomEntrypoint"],
message: "Custom entry point must be specified",
});
}
});

type Schema = z.infer<typeof schema>;
Expand All @@ -95,12 +105,15 @@ export const ShowPreviewSettings = ({ applicationId }: Props) => {
previewHttps: false,
previewPath: "/",
previewCertificateType: "none",
useCustomEntrypoint: false,
previewCustomEntrypoint: undefined,
previewRequireCollaboratorPermissions: true,
},
resolver: zodResolver(schema),
});

const previewHttps = form.watch("previewHttps");
const useCustomEntrypoint = form.watch("useCustomEntrypoint");
const wildcardDomain = form.watch("wildcardDomain");
const isTraefikMeDomain = wildcardDomain?.includes("sslip.io") || false;

Expand All @@ -122,6 +135,8 @@ export const ShowPreviewSettings = ({ applicationId }: Props) => {
previewPath: data.previewPath || "/",
previewCertificateType: data.previewCertificateType || "none",
previewCustomCertResolver: data.previewCustomCertResolver || "",
useCustomEntrypoint: !!data.previewCustomEntrypoint,
previewCustomEntrypoint: data.previewCustomEntrypoint || undefined,
previewRequireCollaboratorPermissions:
data.previewRequireCollaboratorPermissions ?? true,
});
Expand All @@ -142,6 +157,9 @@ export const ShowPreviewSettings = ({ applicationId }: Props) => {
previewPath: formData.previewPath,
previewCertificateType: formData.previewCertificateType,
previewCustomCertResolver: formData.previewCustomCertResolver,
previewCustomEntrypoint: formData.useCustomEntrypoint
? formData.previewCustomEntrypoint
: null,
previewRequireCollaboratorPermissions:
formData.previewRequireCollaboratorPermissions,
})
Expand Down Expand Up @@ -391,6 +409,59 @@ export const ShowPreviewSettings = ({ applicationId }: Props) => {
)}
/>
)}

<FormField
control={form.control}
name="useCustomEntrypoint"
render={({ field }) => (
<FormItem className="flex flex-row items-center justify-between p-3 mt-4 border rounded-lg shadow-xs">
<div className="space-y-0.5">
<FormLabel>Custom Entrypoint</FormLabel>
<FormDescription>
Use custom entrypoint for preview domains.
<br />
"web" and/or "websecure" is used by default.
</FormDescription>
<FormMessage />
</div>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={(checked) => {
field.onChange(checked);
if (!checked) {
form.setValue(
"previewCustomEntrypoint",
undefined,
);
}
}}
/>
</FormControl>
</FormItem>
)}
/>

{useCustomEntrypoint && (
<FormField
control={form.control}
name="previewCustomEntrypoint"
render={({ field }) => (
<FormItem className="w-full">
<FormLabel>Entrypoint Name</FormLabel>
<FormControl>
<Input
placeholder="Enter entrypoint name manually"
className="w-full"
{...field}
value={field.value ?? ""}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
</div>
<div className="grid gap-4 lg:grid-cols-2">
<div className="flex flex-row items-center justify-between rounded-lg border p-4 col-span-2">
Expand Down
1 change: 1 addition & 0 deletions apps/dokploy/drizzle/0173_flowery_ego.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "application" ADD COLUMN "previewCustomEntrypoint" text;
Loading