mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: delete static form self registry
This commit is contained in:
@@ -28,9 +28,14 @@ import { toast } from "sonner";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
const AddRegistrySchema = z.object({
|
const AddRegistrySchema = z.object({
|
||||||
username: z.string().min(1, {
|
username: z
|
||||||
message: "Username is required",
|
.string()
|
||||||
}),
|
.min(1, {
|
||||||
|
message: "Username is required",
|
||||||
|
})
|
||||||
|
.regex(/^[a-zA-Z0-9]+$/, {
|
||||||
|
message: "Username can only contain letters and numbers",
|
||||||
|
}),
|
||||||
password: z.string().min(1, {
|
password: z.string().min(1, {
|
||||||
message: "Password is required",
|
message: "Password is required",
|
||||||
}),
|
}),
|
||||||
@@ -49,18 +54,18 @@ export const AddSelfHostedRegistry = () => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const form = useForm<AddRegistry>({
|
const form = useForm<AddRegistry>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
username: "siumauricio",
|
username: "",
|
||||||
password: "Password123",
|
password: "",
|
||||||
registryUrl: "https://registry.dokploy.com",
|
registryUrl: "",
|
||||||
},
|
},
|
||||||
resolver: zodResolver(AddRegistrySchema),
|
resolver: zodResolver(AddRegistrySchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.reset({
|
form.reset({
|
||||||
registryUrl: "https://registry.dokploy.com",
|
registryUrl: "",
|
||||||
username: "siumauricio",
|
username: "",
|
||||||
password: "Password123",
|
password: "",
|
||||||
});
|
});
|
||||||
}, [form, form.reset, form.formState.isSubmitSuccessful]);
|
}, [form, form.reset, form.formState.isSubmitSuccessful]);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const uploadImage = async (
|
|||||||
: registryUrl;
|
: registryUrl;
|
||||||
|
|
||||||
const registryTag = imagePrefix
|
const registryTag = imagePrefix
|
||||||
? `${registryUrl}/${imagePrefix}/${imageName}`
|
? `${finalURL}/${imagePrefix}/${imageName}`
|
||||||
: `${finalURL}/${imageName}`;
|
: `${finalURL}/${imageName}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -59,3 +59,7 @@ export const uploadImage = async (
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// docker:
|
||||||
|
// endpoint: "unix:///var/run/docker.sock"
|
||||||
|
// exposedByDefault: false
|
||||||
|
// swarmMode: true
|
||||||
|
|||||||
@@ -44,11 +44,6 @@ const createRegistryRouterConfig = async (registry: Registry) => {
|
|||||||
const routerConfig: HttpRouter = {
|
const routerConfig: HttpRouter = {
|
||||||
rule: `Host(\`${registryUrl}\`)`,
|
rule: `Host(\`${registryUrl}\`)`,
|
||||||
service: "dokploy-registry-service",
|
service: "dokploy-registry-service",
|
||||||
...(process.env.NODE_ENV === "production"
|
|
||||||
? {
|
|
||||||
middlewares: ["redirect-to-https"],
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
entryPoints: [
|
entryPoints: [
|
||||||
"web",
|
"web",
|
||||||
...(process.env.NODE_ENV === "production" ? ["websecure"] : []),
|
...(process.env.NODE_ENV === "production" ? ["websecure"] : []),
|
||||||
|
|||||||
Reference in New Issue
Block a user