chiark / gitweb /
actix Files: Break out FILES_PATH
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 30 Mar 2022 20:59:25 +0000 (21:59 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 30 Mar 2022 20:59:25 +0000 (21:59 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/main.rs

index e0389ebaff5d2e1a68b1cd66a4b31f1e6e5ffe87..31eb754d8d58aef8e84268d5fa40dc0d2b0d7389 100644 (file)
@@ -374,6 +374,8 @@ async fn r_bundle(path: Path<(
     .set_content_type(ctype.into_mime())
 }
 
+const FILES_PATH: &'static str = "/_/src";
+
 #[derive(Error)]
 #[error("actix Files produced improper response: {0}")]
 #[derive(Debug, Clone, From)]
@@ -509,7 +511,7 @@ async fn main() -> Result<(),StartupError> {
       .content_type(|ctype| ctype == mime::APPLICATION_JSON)
       .content_type_required(true);
 
-    let src_service = actix_files::Files::new("/_/src", &c.bundled_sources)
+    let src_service = actix_files::Files::new(FILES_PATH, &c.bundled_sources)
       .show_files_listing()
       .redirect_to_slash_directory()
       .index_file("index.html")