From c17b7e2cbbfa7755e2fba8c9001a0415b5c89e09 Mon Sep 17 00:00:00 2001 From: retoor Date: Tue, 26 Nov 2024 05:30:47 +0000 Subject: [PATCH] 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. --- src/rupload/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rupload/app.py b/src/rupload/app.py index 9c94a70..b2b6d54 100644 --- a/src/rupload/app.py +++ b/src/rupload/app.py @@ -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