feat: make upload path configurable via environment variable

The upload directory is now determined by the `UPLOAD_PATH` environment variable, falling back to the default `./uploads` if not set. This change modifies the path resolution logic in the file storage module to support dynamic configuration.
This commit is contained in:
retoor 2024-11-26 05:30:47 +00:00
parent 616f71eeed
commit c17b7e2cbb

View File

@ -287,11 +287,12 @@ def create_app(
max_file_size=max_file_size,
upload_folder_quota=upload_folder_quota,
)
pathlib.Path(upload_path).mkdir(parents=True, exist_ok=True
app.add_routes(
[
web.get("/", handle_index),
web.post("/upload", handle_upload),
web.static("/uploads", "uploads"),
web.static("/uploads", upload_path),
]
)
return app