(jobData: DeploymentJob)
| 2 | import type { DeploymentJob } from "../queues/queue-types"; |
| 3 | |
| 4 | export const deploy = async (jobData: DeploymentJob) => { |
| 5 | try { |
| 6 | const server = await findServerById(jobData.serverId as string); |
| 7 | if (server.serverStatus === "inactive") { |
| 8 | throw new Error("Server is inactive"); |
| 9 | } |
| 10 | |
| 11 | const result = await fetch(`${process.env.SERVER_URL}/deploy`, { |
| 12 | method: "POST", |
| 13 | headers: { |
| 14 | "Content-Type": "application/json", |
| 15 | "X-API-Key": process.env.API_KEY || "NO-DEFINED", |
| 16 | }, |
| 17 | body: JSON.stringify(jobData), |
| 18 | }); |
| 19 | |
| 20 | const data = await result.json(); |
| 21 | return data; |
| 22 | } catch (error) { |
| 23 | throw error; |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | type CancelDeploymentData = |
| 28 | | { applicationId: string; applicationType: "application" } |
no test coverage detected