0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-01-15 01:14:27 -05:00

fix: changing the chunk size needed an app restart

This commit is contained in:
Elias Schneider 2024-04-05 11:31:43 +02:00
parent 1da4feeb89
commit 24e100bd7b
No known key found for this signature in database
GPG key ID: 07E623B294202B6C

View file

@ -8,6 +8,7 @@ import { NestExpressApplication } from "@nestjs/platform-express";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"; import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import * as bodyParser from "body-parser"; import * as bodyParser from "body-parser";
import * as cookieParser from "cookie-parser"; import * as cookieParser from "cookie-parser";
import { NextFunction, Request, Response } from "express";
import * as fs from "fs"; import * as fs from "fs";
import { AppModule } from "./app.module"; import { AppModule } from "./app.module";
import { ConfigService } from "./config/config.service"; import { ConfigService } from "./config/config.service";
@ -20,12 +21,13 @@ async function bootstrap() {
const config = app.get<ConfigService>(ConfigService); const config = app.get<ConfigService>(ConfigService);
app.use( app.use((req: Request, res: Response, next: NextFunction) => {
const chunkSize = config.get("share.chunkSize");
bodyParser.raw({ bodyParser.raw({
type: "application/octet-stream", type: "application/octet-stream",
limit: `${config.get("share.chunkSize")}B`, limit: `${chunkSize}B`,
}), })(req, res, next);
); });
app.use(cookieParser()); app.use(cookieParser());
app.set("trust proxy", true); app.set("trust proxy", true);