mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
⚡ Make max payload size configurable #1447
This commit is contained in:
parent
3c48b06884
commit
2273a4cff2
|
@ -446,6 +446,12 @@ const config = convict({
|
|||
},
|
||||
|
||||
endpoints: {
|
||||
payloadSizeMax: {
|
||||
format: Number,
|
||||
default: 16,
|
||||
env: 'N8N_PAYLOAD_SIZE_MAX',
|
||||
doc: 'Maximum payload size in MB.',
|
||||
},
|
||||
metrics: {
|
||||
enable: {
|
||||
format: 'Boolean',
|
||||
|
|
|
@ -132,6 +132,7 @@ class App {
|
|||
protocol: string;
|
||||
sslKey: string;
|
||||
sslCert: string;
|
||||
payloadSizeMax: number;
|
||||
|
||||
presetCredentialsLoaded: boolean;
|
||||
|
||||
|
@ -145,6 +146,7 @@ class App {
|
|||
this.saveManualExecutions = config.get('executions.saveDataManualExecutions') as boolean;
|
||||
this.executionTimeout = config.get('executions.timeout') as number;
|
||||
this.maxExecutionTimeout = config.get('executions.maxTimeout') as number;
|
||||
this.payloadSizeMax = config.get('endpoints.payloadSizeMax') as number;
|
||||
this.timezone = config.get('generic.timezone') as string;
|
||||
this.restEndpoint = config.get('endpoints.rest') as string;
|
||||
|
||||
|
@ -369,7 +371,7 @@ class App {
|
|||
|
||||
// Support application/json type post data
|
||||
this.app.use(bodyParser.json({
|
||||
limit: '16mb', verify: (req, res, buf) => {
|
||||
limit: this.payloadSizeMax + 'mb', verify: (req, res, buf) => {
|
||||
// @ts-ignore
|
||||
req.rawBody = buf;
|
||||
},
|
||||
|
@ -378,7 +380,7 @@ class App {
|
|||
// Support application/xml type post data
|
||||
// @ts-ignore
|
||||
this.app.use(bodyParser.xml({
|
||||
limit: '16mb', xmlParseOptions: {
|
||||
limit: this.payloadSizeMax + 'mb', xmlParseOptions: {
|
||||
normalize: true, // Trim whitespace inside text nodes
|
||||
normalizeTags: true, // Transform tags to lowercase
|
||||
explicitArray: false, // Only put properties in array if length > 1
|
||||
|
@ -386,7 +388,7 @@ class App {
|
|||
}));
|
||||
|
||||
this.app.use(bodyParser.text({
|
||||
limit: '16mb', verify: (req, res, buf) => {
|
||||
limit: this.payloadSizeMax + 'mb', verify: (req, res, buf) => {
|
||||
// @ts-ignore
|
||||
req.rawBody = buf;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue