fix(server/api): envoi du ComposeConfig lors d'un reset d'instance

- Le reset ne transmettait que l'ID, l'agent écrivait un docker-compose.yml vide
- Correction pour envoyer type, port et composeConfig comme au start
This commit is contained in:
EduBox Dev
2026-06-17 20:34:42 +00:00
parent c1d1038a52
commit 5c4c9f3531
+12 -1
View File
@@ -115,7 +115,18 @@ export async function PATCH(req: NextRequest) {
}); });
if (!sent) await prisma.instance.update({ where: { id }, data: { status: "error" } }); if (!sent) await prisma.instance.update({ where: { id }, data: { status: "error" } });
} else if (action === "reset") { } else if (action === "reset") {
sendToNode(instance.nodeId, { action: "reset", instanceId: instance.id }); const sent = sendToNode(instance.nodeId, {
action: "reset",
instanceId: instance.id,
type: instance.template.type,
port: instance.port,
composeConfig: instance.template.composeConfig
.replace(/{PORT}/g, String(instance.port))
.replace(/{INSTANCE_ID}/g, instance.id)
.replace(/{PUBLIC_URL}/g, publicUrl || `http://localhost:${instance.port}`)
.replace(/{PUBLIC_DOMAIN}/g, domain || "localhost"),
});
if (!sent) await prisma.instance.update({ where: { id }, data: { status: "error" } });
} }
return NextResponse.json({ ok: true }); return NextResponse.json({ ok: true });