chiark / gitweb /
Avoid need for bundled-sources
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 Jan 2021 03:32:54 +0000 (03:32 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 Jan 2021 03:32:54 +0000 (03:32 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/main.rs
src/config.rs
wdriver.rs

index 14b9544cc5de4bbb6ad1c7507972853bf0cda5b1..36d731f8238a7868bf4d3e8da34b95941b26e091 100644 (file)
@@ -261,7 +261,7 @@ fn main() {
 
   debug!("resolved config: {:#?}", c);
 
-  {
+  if c.check_bundled_sources {
     let check = format!("{}/otter/index.html", &c.bundled_sources);
     fs::metadata(&check)
       .context(check.clone())
index 0022149420c896d08cc376c96e5d8231fc529101..abe5a6cfd1d27bc555e0356379d1c934b37897f0 100644 (file)
@@ -36,6 +36,8 @@ pub struct ServerConfigSpec {
   pub shapelibs: Option<Vec<shapelib::Config1>>,
   pub sendmail: Option<String>,
   pub debug_js_inject_file: Option<String>,
+  /// Disable this for local testing only.  See LICENCE.
+  pub check_bundled_sources: Option<bool>,
 }
 
 #[derive(Debug,Clone)]
@@ -60,6 +62,7 @@ pub struct ServerConfig {
   pub shapelibs: Vec<shapelib::Config1>,
   pub sendmail: String,
   pub debug_js_inject: Arc<String>,
+  pub check_bundled_sources: bool,
 }
 
 impl TryFrom<ServerConfigSpec> for WholeServerConfig {
@@ -71,7 +74,7 @@ impl TryFrom<ServerConfigSpec> for WholeServerConfig {
       http_port, public_url, sse_wildcard_url, rocket_workers,
       template_dir, nwtemplate_dir, wasm_dir,
       log, bundled_sources, shapelibs, sendmail,
-      debug_js_inject_file,
+      debug_js_inject_file, check_bundled_sources,
     } = spec;
 
     if let Some(cd) = change_directory {
@@ -143,12 +146,14 @@ impl TryFrom<ServerConfigSpec> for WholeServerConfig {
       None => "".into(),
     });
 
+    let check_bundled_sources = check_bundled_sources.unwrap_or(true); 
+
     let server = ServerConfig {
       save_dir, command_socket, debug,
       http_port, public_url, sse_wildcard_url, rocket_workers,
       template_dir, nwtemplate_dir, wasm_dir,
       bundled_sources, shapelibs, sendmail,
-      debug_js_inject,
+      debug_js_inject, check_bundled_sources,
     };
     WholeServerConfig {
       server: Arc::new(server),
index 1cb899d58bad136289d0df87e0efc39bd06b4fe2..a9b9746033e54ff395600811d5a9741442e77d5b 100644 (file)
@@ -556,6 +556,7 @@ wasm_dir = "@target@/packed-wasm"
 shapelibs = [ "@src@/library/*.toml" ]
 
 debug_js_inject_file = "@src@/templates/log-save.js"
+check_bundled_sources = false # For testing only! see LICENCE!
 
 [log]
 global_level = 'debug'