diff --git a/src/config.rs b/src/config.rs index 8532770..13615e3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,6 +37,10 @@ pub struct EngineConfig { #[serde_as(as = "DurationSeconds")] pub max_temp_lifetime: Duration, + /// Maximum length (in bytes) a file can be before the server will + /// decide not to remove its EXIF data. + pub max_strip_len: usize, + /// Motd displayed when the server's index page is visited. /// /// This isn't explicitly engine-related but the engine is what gets passed to routes, @@ -73,6 +77,7 @@ pub struct CacheConfig { #[derive(Deserialize)] pub struct HttpConfig { + /// The IP address the HTTP server should listen on pub listen_on: String, } diff --git a/src/engine.rs b/src/engine.rs index d739c75..91b5cef 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -76,7 +76,7 @@ impl Engine { } /// Fetch an upload - /// + /// /// This will first try to read from cache, and then disk after. /// If an upload is eligible to be cached, it will be cached and /// sent back as a cache response instead of a disk response. @@ -160,7 +160,7 @@ impl Engine { } /// Save a file to disk, and optionally cache. - /// + /// /// This also handles custom file lifetimes and EXIF data removal. pub async fn save( &self, @@ -196,7 +196,7 @@ impl Engine { Some(Some("png" | "jpg" | "jpeg" | "webp" | "tiff")) ) && !keep_exif - && provided_len <= 16_777_216; + && provided_len <= self.cfg.max_strip_len; // read and save upload while let Some(chunk) = stream.next().await {