diff --git a/src/app.ts b/src/app.ts index 58598bdc..ef93ea80 100644 --- a/src/app.ts +++ b/src/app.ts @@ -14,6 +14,7 @@ * along with this program. If not, see . */ import { + SCConfigFile, SCNotFoundErrorResponse, SCRequestBodyTooLargeErrorResponse, SCSyntaxErrorResponse, @@ -40,6 +41,7 @@ import {Elasticsearch} from './storage/elasticsearch/Elasticsearch'; export const app = express(); const isTestEnvironment = process.env.NODE_ENV !== 'production'; +const configFile: SCConfigFile = app.get('config'); async function configureApp() { // request loggers have to be the first middleware to be set in express @@ -73,7 +75,7 @@ async function configureApp() { const chunkGatherer = (chunk: Buffer) => { bodySize += chunk.byteLength; // when adding each chunk size to the total size, check how large it now is. - if (bodySize > 512 * 1024) { + if (bodySize > configFile.backend.maxRequestBodySize) { req.off('data', chunkGatherer); req.off('end', endCallback); // return an error in the response