diff rust/src/main.rs @ 623:03167105f6de rust

ignore missing local.conf
author Matt Johnston <matt@ucc.asn.au>
date Sun, 16 Apr 2017 22:50:20 +0800
parents 8fda564cc46f
children 2710649ab71e
line wrap: on
line diff
--- a/rust/src/main.rs	Sun Apr 16 22:50:05 2017 +0800
+++ b/rust/src/main.rs	Sun Apr 16 22:50:20 2017 +0800
@@ -8,6 +8,7 @@
 extern crate tokio_curl;
 extern crate curl;
 extern crate serde_json;
+extern crate libc;
 
 #[macro_use] 
 extern crate lazy_static;
@@ -151,6 +152,14 @@
     let conf_filename = "local.conf";
     nconfig.merge_file(conf_filename)
         .unwrap_or_else(|e| {
+            if let TemplogErrorKind::Io(ref ioe) = *e.kind() {
+                if let Some(errno) = ioe.raw_os_error() {
+                    if errno == libc::ENOENT {
+                        return nconfig;
+                    }
+                }
+            }
+
             println!("Couldn't parse {}: {}", conf_filename, e);
             std::process::exit(1);
     })