mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-01 10:58:12 +08:00
#6 add GATEWAY_ENABLE_UPLOAD environment variable
routes that modify disk are not added unless the env variable is set.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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():
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
<u>Cache Status: view status of launched cellxgene servers.</u></a>
|
||||
</div>
|
||||
|
||||
{% if enable_upload %}
|
||||
<br>
|
||||
|
||||
<h1 style="padding-left:35px">
|
||||
How To Upload Data:
|
||||
How To Upload Data via HTTP:
|
||||
</h1>
|
||||
<ol style="padding-left:85px;">
|
||||
<li>
|
||||
@@ -83,12 +83,12 @@
|
||||
<br>
|
||||
<li>Take a look at your data using the file crawler link above</li>
|
||||
</ol>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
|
||||
<h1 style="padding-left:35px">
|
||||
How To Upload Data via SSH and SCP (Linux):
|
||||
How To Upload Data via SSH and SCP:
|
||||
</h1>
|
||||
<ol style="padding-left:85px;">
|
||||
<li>
|
||||
|
||||
Reference in New Issue
Block a user