aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 449d2ae..6a048c2 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -33,6 +33,9 @@ pub struct MiniserveConfig {
/// Path to be served by miniserve
pub path: std::path::PathBuf,
+ /// Temporary directory that should be used when files are uploaded to the server
+ pub temp_upload_directory: Option<std::path::PathBuf>,
+
/// Port on which miniserve will be listening
pub port: u16,
@@ -275,9 +278,16 @@ impl MiniserveConfig {
.transpose()?
.unwrap_or_default();
+ let temp_upload_directory = args.temp_upload_directory.as_ref().take().map(|v| if v.exists() && v.is_dir() {
+ Ok(v.clone())
+ } else {
+ Err(anyhow!("Upload temporary directory must exist and be a directory. Validate that path {v:?} meets those requirements"))
+ }).transpose()?;
+
Ok(Self {
verbose: args.verbose,
path: args.path.unwrap_or_else(|| PathBuf::from(".")),
+ temp_upload_directory,
port,
interfaces,
auth,