mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-15 05:11:26 +00:00
refactor: make deploy webhook body limit configurable via DEPLOY_WEBHOOK_MAX_BODY_SIZE
This commit is contained in:
@@ -63,6 +63,7 @@ vi.mock("@dokploy/server/db", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("@dokploy/server", () => ({
|
||||
DEPLOY_WEBHOOK_MAX_BODY_SIZE: 25 * 1024 * 1024,
|
||||
IS_CLOUD: false,
|
||||
shouldDeploy: mocks.shouldDeploy,
|
||||
checkUserRepositoryPermissions: vi.fn(),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
type Bitbucket,
|
||||
DEPLOY_WEBHOOK_MAX_BODY_SIZE,
|
||||
getBitbucketHeaders,
|
||||
IS_CLOUD,
|
||||
shouldDeploy,
|
||||
@@ -35,7 +36,7 @@ const getPackageVersion = (headers: any, body: any) => {
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: {
|
||||
sizeLimit: "25mb",
|
||||
sizeLimit: DEPLOY_WEBHOOK_MAX_BODY_SIZE,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { IS_CLOUD, shouldDeploy } from "@dokploy/server";
|
||||
import {
|
||||
DEPLOY_WEBHOOK_MAX_BODY_SIZE,
|
||||
IS_CLOUD,
|
||||
shouldDeploy,
|
||||
} from "@dokploy/server";
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
@@ -18,7 +22,7 @@ import {
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: {
|
||||
sizeLimit: "25mb",
|
||||
sizeLimit: DEPLOY_WEBHOOK_MAX_BODY_SIZE,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
checkUserRepositoryPermissions,
|
||||
createPreviewDeployment,
|
||||
createSecurityBlockedComment,
|
||||
DEPLOY_WEBHOOK_MAX_BODY_SIZE,
|
||||
findGithubById,
|
||||
findPreviewDeploymentByApplicationId,
|
||||
findPreviewDeploymentsByPullRequestId,
|
||||
@@ -29,7 +30,7 @@ const getGithubRepositoryOwner = (githubBody: any) =>
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: {
|
||||
sizeLimit: "25mb",
|
||||
sizeLimit: DEPLOY_WEBHOOK_MAX_BODY_SIZE,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ export const DOKPLOY_DOCKER_PORT = process.env.DOKPLOY_DOCKER_PORT
|
||||
|
||||
export const CLEANUP_CRON_JOB = "50 23 * * *";
|
||||
|
||||
// Body size limits for the OpenAPI catch-all route (pages/api/[...trpc].ts).
|
||||
// Body size limits for the OpenAPI catch-all route (pages/api/[...trpc].ts) and the deploy webhooks (pages/api/deploy/*).
|
||||
const parseByteSize = (envVar: string, fallback: number): number => {
|
||||
const raw = process.env[envVar];
|
||||
if (!raw) return fallback;
|
||||
@@ -35,6 +35,11 @@ export const OPENAPI_MAX_UPLOAD_SIZE = parseByteSize(
|
||||
1024 * 1024 * 1024, // 1gb
|
||||
);
|
||||
|
||||
export const DEPLOY_WEBHOOK_MAX_BODY_SIZE = parseByteSize(
|
||||
"DEPLOY_WEBHOOK_MAX_BODY_SIZE",
|
||||
25 * 1024 * 1024, // 25mb, GitHub's max webhook payload
|
||||
);
|
||||
|
||||
type DockerSocketCandidate = {
|
||||
label: string;
|
||||
path: string;
|
||||
|
||||
Reference in New Issue
Block a user