- add a configurable ROMM_TMP_PATH environment variable for controlling where large file operations take place like 7z extraction

This commit is contained in:
Marius Luca
2025-10-09 16:50:25 +03:00
parent c46c6dea91
commit 1604406e2b
2 changed files with 6 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ DEV_SQL_ECHO: Final = str_to_bool(os.environ.get("DEV_SQL_ECHO", "false"))
# PATHS
ROMM_BASE_PATH: Final = os.environ.get("ROMM_BASE_PATH", "/romm")
ROMM_TMP_PATH: Final = os.environ.get("ROMM_TMP_PATH", None)
LIBRARY_BASE_PATH: Final = f"{ROMM_BASE_PATH}/library"
RESOURCES_BASE_PATH: Final = f"{ROMM_BASE_PATH}/resources"
ASSETS_BASE_PATH: Final = f"{ROMM_BASE_PATH}/assets"

View File

@@ -7,6 +7,10 @@ from pathlib import Path
from logger.logger import log
from config import (
ROMM_TMP_PATH,
)
SEVEN_ZIP_PATH = "/usr/bin/7zz"
FILE_READ_CHUNK_SIZE = 1024 * 8
@@ -60,7 +64,7 @@ def process_file_7z(
if not largest_file:
return False
with tempfile.TemporaryDirectory() as temp_dir:
with tempfile.TemporaryDirectory(dir = ROMM_TMP_PATH) as temp_dir:
log.debug(f"Extracting {largest_file} from {file_path}...")
temp_path = Path(temp_dir)