aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Mark <[email protected]>2022-06-06 17:25:36 -0700
committerGravatar Mark <[email protected]>2022-06-06 17:25:36 -0700
commit91c28279bb8f3c8087d2c5abec696a6409b94d72 (patch)
tree65e96c67c1f08667f2b8247ed60c8c69f7e7db62
parentAccept NsJail arguments via the WSGI app (SnekAPI) (diff)
Remove env var support for NsJail args
The values can effectively be set via the Gunicorn config instead.
-rw-r--r--README.md4
-rw-r--r--snekbox/nsjail.py8
2 files changed, 2 insertions, 10 deletions
diff --git a/README.md b/README.md
index 533481e..43c9ca1 100644
--- a/README.md
+++ b/README.md
@@ -77,12 +77,8 @@ All environment variables have defaults and are therefore not required to be set
Name | Description
---- | -----------
`DEBUG` | Enable debug logging if set to a non-empty value.
-`NSJAIL_CFG` | Path to the NsJail configuration file.
-`NSJAIL_PATH` | Path to the NsJail binary.
`SNEKBOX_SENTRY_DSN` | [Data Source Name] for Sentry. Sentry is disabled if left unset.
-Note: relative paths are relative to the root of the repository.
-
## Third-party Packages
By default, the Python interpreter has no access to any packages besides the
diff --git a/snekbox/nsjail.py b/snekbox/nsjail.py
index 5616733..63afdef 100644
--- a/snekbox/nsjail.py
+++ b/snekbox/nsjail.py
@@ -1,5 +1,4 @@
import logging
-import os
import re
import subprocess
import sys
@@ -22,9 +21,6 @@ LOG_PATTERN = re.compile(
r"\[(?P<level>(I)|[DWEF])\]\[.+?\](?(2)|(?P<func>\[\d+\] .+?:\d+ )) ?(?P<msg>.+)"
)
-NSJAIL_PATH = os.getenv("NSJAIL_PATH", "/usr/sbin/nsjail")
-NSJAIL_CFG = os.getenv("NSJAIL_CFG", "./config/snekbox.cfg")
-
class NsJail:
"""
@@ -35,8 +31,8 @@ class NsJail:
def __init__(
self,
- nsjail_path: str = NSJAIL_PATH,
- config_path: str = NSJAIL_CFG,
+ nsjail_path: str = "/usr/sbin/nsjail",
+ config_path: str = "./config/snekbox.cfg",
max_output_size: int = 1_000_000,
read_chunk_size: int = 10_000,
):