refactor: update webhooks and added validation to prevent deploy when the server is inactive

This commit is contained in:
Mauricio Siu
2024-10-21 00:34:16 -06:00
parent 1907e7e59c
commit fbda00f059
18 changed files with 440 additions and 202 deletions

View File

@@ -1,7 +1,12 @@
import { findServerById } from "@dokploy/server";
import type { DeploymentJob } from "../queues/deployments-queue";
export const deploy = async (jobData: DeploymentJob) => {
try {
const server = await findServerById(jobData.serverId as string);
if (server.serverStatus === "inactive") {
throw new Error("Server is inactive");
}
const result = await fetch(`${process.env.SERVER_URL}/deploy`, {
method: "POST",
headers: {