default values

This commit is contained in:
Thomas Hobson 2021-04-23 11:54:37 +12:00
parent 9814217aee
commit 589dfec6df
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
2 changed files with 8 additions and 18 deletions

View File

@ -22,16 +22,6 @@ module.exports = {
.contains('/'),
body('files.*.content')
.isString(),
body('compile_timeout')
.isNumeric(),
body('run_timeout')
.isNumeric(),
body('stdin')
.isString(),
body('args')
.isArray(),
body('args.*')
.isString()
],
// POST /jobs
@ -50,11 +40,11 @@ module.exports = {
runtime,
alias: req.body.language,
files: req.body.files,
args: req.body.args,
stdin: req.body.stdin,
args: req.body.args || [],
stdin: req.body.stdin || "",
timeouts: {
run: req.body.run_timeout,
compile: req.body.compile_timeout
run: req.body.run_timeout || 3000,
compile: req.body.compile_timeout || 10000
}
});

View File

@ -197,10 +197,10 @@ This endpoint requests execution of some arbitrary code.
- `files` (**required**) An array of files containing code or other data that should be used for execution. The first file in this array is considered the main file.
- `files[].name` (**required**) The name of the file to upload, must be a string containing no path.
- `files[].content` (**required**) The content of the files to upload, must be a string containing text to write.
- `stdin` (**required**) The text to pass as stdin to the program. Must be a string, can be left blank.
- `args` (**required**) The arguments to pass to the program. Must be an array.
- `compile_timeout` (**required**) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number.
- `run_timeout` (**required**) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number.
- `stdin` (**optional**) The text to pass as stdin to the program. Must be a string, can be left blank.
- `args` (**optional**) The arguments to pass to the program. Must be an array.
- `compile_timeout` (**optional**) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number.
- `run_timeout` (**optional**) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number.
```json
{