Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ const options = {
x => fss.exists_sync(x) || `Directory ${x} does not exist`,
],
},
body_parser_json: {
desc: 'Body size limit for JSON requests',
default: '100kb', //https://github.com/expressjs/body-parser#limit-2
validators: [
x => /^\d+(kb|mb|gb)$/i.test(x) || `${x} is not a valid size (e.g. 10mb, 100kb)`,
],
},
runner_uid_min: {
desc: 'Minimum uid to use for runner',
default: 1001,
Expand Down
2 changes: 1 addition & 1 deletion api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ expressWs(app);
logger.debug('Registering middleware');

app.use(body_parser.urlencoded({ extended: true }));
app.use(body_parser.json());
app.use(body_parser.json({ limit: config.body_parser_json }));

app.use((err, req, res, next) => {
return res.status(400).send({
Expand Down
11 changes: 11 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ Port and IP address to bind the Piston API to.

This changes the bind address inside the container, and thus serves no purpose when running in a container

## Body Parser JSON Limit

```yaml
key: PISTON_BODY_PARSER_JSON
default: 100kb
```

Maximum size of the JSON request body.

Increase this value if you need to submit large code or arguments (e.g. `10mb`).

## Data Directory

```yaml
Expand Down