smolcgi: allow STORAGE_PATH env var
This commit is contained in:
parent
d8ed7d2921
commit
d0154c4a40
|
@ -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)
|
||||
|
|
Reference in a new issue