From 577044ddbd70f5f128512c1a021329fb4c7e7eb3 Mon Sep 17 00:00:00 2001 From: Alec Di Vito Date: Sat, 22 Feb 2025 13:44:16 -0500 Subject: feat: address comments; add in new argument (`temp-directory`); add comments to upload code; add tests --- src/args.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs index 17f6c84..e9243f5 100644 --- a/src/args.rs +++ b/src/args.rs @@ -26,6 +26,20 @@ pub struct CliArgs { #[arg(value_hint = ValueHint::AnyPath, env = "MINISERVE_PATH")] pub path: Option, + /// The path to where file uploads will be written to before being moved to their + /// correct location. It's wise to make sure that this directory will be written to + /// disk and not into memory. + /// + /// This value will only be used **IF** file uploading is enabled. If this option is + /// not set, the operating system default temporary directory will be used. + #[arg( + long = "temp-directory", + value_hint = ValueHint::FilePath, + requires = "allowed_upload_dir", + env = "MINISERVER_TEMP_UPLOAD_DIRECTORY") + ] + pub temp_upload_directory: Option, + /// The name of a directory index file to serve, like "index.html" /// /// Normally, when miniserve serves a directory, it creates a listing for that directory. @@ -171,6 +185,14 @@ pub struct CliArgs { /// /// For example, a value of 4 would mean that the web browser will only upload /// 4 files at a time to the web server when using the web browser interface. + /// + /// When the value is kept at 0, it attempts to resolve all the uploads at once + /// in the web browser. + /// + /// NOTE: Web pages have a limit of how many active HTTP connections that they + /// can make at one time, so even though you might set a concurrency limit of + /// 100, the browser might only make progress on the max amount of connections + /// it allows the web page to have open. #[arg( long = "web-upload-files-concurrency", env = "MINISERVE_WEB_UPLOAD_CONCURRENCY", -- cgit v1.2.3