From d0154c4a40b9435c06f5a81455581b3a24e1bc0b Mon Sep 17 00:00:00 2001 From: dece Date: Sat, 8 Jan 2022 16:30:09 +0100 Subject: [PATCH] smolcgi: allow STORAGE_PATH env var --- smolcgi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/smolcgi.py b/smolcgi.py index 88e0634..6f659ac 100644 --- a/smolcgi.py +++ b/smolcgi.py @@ -5,8 +5,8 @@ from pathlib import Path from urllib.parse import unquote -def getenv(name): - return environ.get(name, "") +def getenv(name, default=""): + return environ.get(name, default) gateway_interface = getenv("GATEWAY_INTERFACE") @@ -50,7 +50,8 @@ def get_storage_path(): script_filename = script_name.split("/")[-1] path = getenv(f"GEMINI_{script_filename.upper()}_STORAGE") if not path: - path = f"/home/gemini/storage/{script_filename}" + storage_root = getenv("STORAGE_ROOT", "/storage") + path = f"{storage_root}/{script_filename}" path = Path(path) if not path.exists(): path.mkdir(parents=True)