feat: add body size limit config as env var

This commit is contained in:
Kilian Decaderincourt 2021-12-01 17:16:54 +01:00
parent 77479b8a5d
commit 2e433c3233
2 changed files with 6 additions and 5 deletions

View File

@ -12,8 +12,6 @@ It can be used with [kiliandeca/excalidraw-fork](https://gitlab.com/kiliandeca/e
| --------------- | ------------------------------------------------------------ | ---------------- |
| `PORT` | Server listening port | 8080 |
| `GLOBAL_PREFIX` | API global prefix for every routes | `/api/v2` |
| `STORAGE_URI` | [Keyv](https://github.com/jaredwray/keyv) connection string | `""` (in memory) |
| `STORAGE_URI` | [Keyv](https://github.com/jaredwray/keyv) connection string, example: `redis://user:pass@localhost:6379`. Availabe Keyv storage adapter: redis, mongo, postgres and mysql | `""` (in memory **non-persistent**) |
| `LOG_LEVEL` | Log level (`debug`, `verbose`, `log`, `warn`, `error`) | `warn` |
Availabe Keyv storage adapter: redis, mongo, postgres and mysql
| `BODY_LIMIT` | Payload size limit for scenes or images | `50mb` |

View File

@ -4,7 +4,10 @@ import { hasBody } from 'type-is';
// Excalidraw Front end doesn't send a Content Type Header
// so we tell raw parser to check if there is a body
const rawParserMiddleware = raw({ type: hasBody });
const rawParserMiddleware = raw({
type: hasBody,
limit: process.env.BODY_LIMIT ?? '50mb',
});
@Injectable()
export class RawParserMiddleware implements NestMiddleware {