chiark / gitweb /
bundled_sources config
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Sep 2020 23:01:51 +0000 (00:01 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Sep 2020 23:01:51 +0000 (00:01 +0100)
src/global.rs

index 71e050bb9ac3a48d6eee6f0217083476a4fcac8d..3d09208dbacfb7a06e61f295ab597f4f2dd2a3d1 100644 (file)
@@ -973,6 +973,7 @@ pub struct ServerConfigSpec {
   pub rocket_workers: Option<u16>,
   pub template_dir: Option<String>,
   pub log: Option<toml::Value>,
+  pub bundled_sources: Option<String>,
 }
 
 #[derive(Debug,Clone)]
@@ -984,6 +985,7 @@ pub struct ServerConfig {
   pub rocket_workers: u16,
   pub template_dir: String,
   pub log: LogSpecification,
+  pub bundled_sources: String,
 }
 
 impl TryFrom<ServerConfigSpec> for ServerConfig {
@@ -992,7 +994,7 @@ impl TryFrom<ServerConfigSpec> for ServerConfig {
   fn try_from(spec: ServerConfigSpec) -> ServerConfig {
     let ServerConfigSpec {
       save_directory, command_socket, debug,
-      http_port, rocket_workers, template_dir, log,
+      http_port, rocket_workers, template_dir, log, bundled_sources,
     } = spec;
 
     let save_directory = save_directory
@@ -1026,9 +1028,12 @@ impl TryFrom<ServerConfigSpec> for ServerConfig {
     let log = LogSpecification::from_toml(&log)
       .context("log specification")?;
 
+    let bundled_sources = bundled_sources
+      .unwrap_or_else(|| save_directory.clone());
+
     ServerConfig {
       save_directory, command_socket, debug,
-      http_port, rocket_workers, template_dir, log,
+      http_port, rocket_workers, template_dir, log, bundled_sources,
     }
   }
 }