diff --git a/Readme.md b/Readme.md
index 2b33ea1..41553f3 100644
--- a/Readme.md
+++ b/Readme.md
@@ -65,7 +65,10 @@ Here's what the environment variables mean:
* `CELLXGENE_DATA` - a directory that can contain subdirectories with `.h5ad` data files, *without* trailing slash, e.g. `/mnt/cellxgene_data`
* `GATEWAY_HOST` - the hostname and port that the gateway will run on, typically `localhost:5005` if running locally
* `GATEWAY_PROTOCOL` - typically http when running locally, can be https when deployed if the gateway is behind a load balancer or reverse proxy.
-* `GATEWAY_EXTRA_SCRIPTS` - (optional) JSON array of script paths, will be embedded into each page and forwarded with `--scripts` to cellxgene server
+* `GATEWAY_IP` - ip addess of instance gateway is running on, mostly used to display SSH instructions
+Optional environment variables:
+* `GATEWAY_EXTRA_SCRIPTS` - JSON array of script paths, will be embedded into each page and forwarded with `--scripts` to cellxgene server
+* `GATEWAY_ENABLE_UPLOAD` - Set to `true` or `1` to enable HTTP uploads. This is not recommended for a public server.
The defaults should be fine if you set up a venv and cellxgene_data folder as above.
diff --git a/cellxgene_gateway/env.py b/cellxgene_gateway/env.py
index 9e58c2b..f6dc1b6 100644
--- a/cellxgene_gateway/env.py
+++ b/cellxgene_gateway/env.py
@@ -16,6 +16,7 @@ gateway_protocol = os.environ.get("GATEWAY_PROTOCOL")
ip = os.environ.get("GATEWAY_IP")
extra_scripts = os.environ.get("GATEWAY_EXTRA_SCRIPTS")
ttl = os.environ.get("GATEWAY_TTL")
+enable_upload = os.environ.get("GATEWAY_ENABLE_UPLOAD", "").lower() in ['true', '1']
env_vars = {
"CELLXGENE_LOCATION": cellxgene_location,
diff --git a/cellxgene_gateway/gateway.py b/cellxgene_gateway/gateway.py
index f43983b..3743b8c 100644
--- a/cellxgene_gateway/gateway.py
+++ b/cellxgene_gateway/gateway.py
@@ -99,10 +99,9 @@ def index():
cellxgene_data=env.cellxgene_data,
extra_scripts=get_extra_scripts(),
users=users,
+ enable_upload=env.enable_upload,
)
-
-@app.route("/make_user", methods=["POST"])
def make_user():
dir_name = request.form["directory"]
@@ -111,7 +110,6 @@ def make_user():
return redirect(location, code=302)
-@app.route("/make_subdir", methods=["POST"])
def make_subdir():
parent_path = os.path.join(env.cellxgene_data, request.form["usernames"])
dir_name = request.form["directory"]
@@ -121,7 +119,6 @@ def make_subdir():
return redirect(location, code=302)
-@app.route("/upload_file", methods=["POST"])
def upload_file():
upload_dir = request.form["path"]
@@ -153,6 +150,11 @@ def upload_file():
return redirect(env.location, code=302)
+if env.enable_upload:
+ app.add_url_rule('/make_user', 'make_user', make_user, methods=["POST"])
+ app.add_url_rule('/make_subdir', 'make_subdir', make_subdir, methods=["POST"])
+ app.add_url_rule('/upload_file', 'upload_file', upload_file, methods=["POST"])
+
@app.route("/filecrawl.html")
def filecrawl():
diff --git a/cellxgene_gateway/templates/index.html b/cellxgene_gateway/templates/index.html
index b306108..3d95124 100644
--- a/cellxgene_gateway/templates/index.html
+++ b/cellxgene_gateway/templates/index.html
@@ -44,10 +44,10 @@
Cache Status: view status of launched cellxgene servers.
+ {% if enable_upload %}
-