Skip to content

feat(git-providers): support docker url and http connections for git providers #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: canary
Choose a base branch
from
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 @@ -17,6 +17,12 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import { Input } from "@/components/ui/input";
import { api } from "@/utils/api";
import {
Expand All @@ -39,6 +45,7 @@ const Schema = z.object({
giteaUrl: z.string().min(1, {
message: "Gitea URL is required",
}),
giteaUrlAlt: z.string(),
clientId: z.string().min(1, {
message: "Client ID is required",
}),
Expand Down Expand Up @@ -70,6 +77,7 @@ export const AddGiteaProvider = () => {
redirectUri: webhookUrl,
name: "",
giteaUrl: "https://gitea.com",
giteaUrlAlt: "",
},
resolver: zodResolver(Schema),
});
Expand All @@ -83,6 +91,7 @@ export const AddGiteaProvider = () => {
redirectUri: webhookUrl,
name: "",
giteaUrl: "https://gitea.com",
giteaUrlAlt: "",
});
}, [form, webhookUrl, isOpen]);

Expand All @@ -95,6 +104,7 @@ export const AddGiteaProvider = () => {
name: data.name,
redirectUri: data.redirectUri,
giteaUrl: data.giteaUrl,
giteaUrlAlt: data.giteaUrlAlt,
organizationName: data.organizationName,
})) as unknown as GiteaProviderResponse;

Expand Down Expand Up @@ -273,6 +283,36 @@ export const AddGiteaProvider = () => {
)}
/>

<Accordion type="single" collapsible className="w-full">
<AccordionItem value="advanced">
<AccordionTrigger>Advanced Settings</AccordionTrigger>
<AccordionContent>
<p className="text-muted-foreground text-sm mb-6">
<b>Gitea Docker Url</b>: useful only when Gitea's front
end is not exposed to the internet (i.e. you use remote
tunneling) and Dokploy can't access the browser
reachable Gitea Url. In most cases, this is unnessesary.
</p>
<FormField
control={form.control}
name="giteaUrlAlt"
render={({ field }) => (
<FormItem>
<FormLabel>Gitea Docker URL</FormLabel>
<FormControl>
<Input
placeholder="http://gitea:3000"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</AccordionContent>
</AccordionItem>
</Accordion>

<Button isLoading={form.formState.isSubmitting}>
Configure Gitea App
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import { Input } from "@/components/ui/input";
import { api } from "@/utils/api";
import { getGiteaOAuthUrl } from "@/utils/gitea-utils";
Expand All @@ -30,6 +36,7 @@ import { z } from "zod";
const formSchema = z.object({
name: z.string().min(1, "Name is required"),
giteaUrl: z.string().min(1, "Gitea URL is required"),
giteaUrlAlt: z.string(),
clientId: z.string().min(1, "Client ID is required"),
clientSecret: z.string().min(1, "Client Secret is required"),
});
Expand Down Expand Up @@ -94,6 +101,7 @@ export const EditGiteaProvider = ({ giteaId }: Props) => {
defaultValues: {
name: "",
giteaUrl: "https://gitea.com",
giteaUrlAlt: "",
clientId: "",
clientSecret: "",
},
Expand All @@ -104,6 +112,7 @@ export const EditGiteaProvider = ({ giteaId }: Props) => {
form.reset({
name: gitea.gitProvider?.name || "",
giteaUrl: gitea.giteaUrl || "https://gitea.com",
giteaUrlAlt: gitea.giteaUrlAlt || "",
clientId: gitea.clientId || "",
clientSecret: gitea.clientSecret || "",
});
Expand All @@ -116,6 +125,7 @@ export const EditGiteaProvider = ({ giteaId }: Props) => {
gitProviderId: gitea?.gitProvider?.gitProviderId || "",
name: values.name,
giteaUrl: values.giteaUrl,
giteaUrlAlt: values.giteaUrlAlt,
clientId: values.clientId,
clientSecret: values.clientSecret,
})
Expand Down Expand Up @@ -255,6 +265,33 @@ export const EditGiteaProvider = ({ giteaId }: Props) => {
)}
/>

<Accordion type="single" collapsible className="w-full">
<AccordionItem value="advanced">
<AccordionTrigger>Advanced Settings</AccordionTrigger>
<AccordionContent>
<p className="text-muted-foreground text-sm mb-6">
<b>Gitea Docker Url</b>: useful only when Gitea's front end
is not exposed to the internet (i.e. you use remote
tunneling) and Dokploy can't access the browser reachable
Gitea Url. In most cases, this is unnessesary.
</p>
<FormField
control={form.control}
name="giteaUrlAlt"
render={({ field }) => (
<FormItem>
<FormLabel>Gitea Docker URL</FormLabel>
<FormControl>
<Input placeholder="http://gitea:3000" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</AccordionContent>
</AccordionItem>
</Accordion>

<div className="flex justify-end gap-2">
<Button
type="button"
Expand Down
1 change: 1 addition & 0 deletions apps/dokploy/drizzle/0085_green_rhodey.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "gitea" ADD COLUMN "giteaUrlAlt" text;
Loading