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:
parent
1da4feeb89
commit
24e100bd7b
1 changed files with 6 additions and 4 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue