# HG changeset patch # User Matt Johnston # Date 1492354220 -28800 # Node ID 03167105f6deb2b20e4b58b8928d524202f84467 # Parent 5b456905eaac10a1bbed14f066cdd2563e268575 ignore missing local.conf diff -r 5b456905eaac -r 03167105f6de rust/src/main.rs --- 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); }) diff -r 5b456905eaac -r 03167105f6de rust/src/types.rs --- a/rust/src/types.rs Sun Apr 16 22:50:05 2017 +0800 +++ b/rust/src/types.rs Sun Apr 16 22:50:20 2017 +0800 @@ -113,6 +113,10 @@ TemplogError::new_kind(msg, TemplogErrorKind::SerdeJson(e)) } + pub fn kind(&self) -> &TemplogErrorKind { + return &self.kind; + } + fn new_kind(msg: &str, k: TemplogErrorKind) -> Self { let mut s = TemplogError { msg: msg.to_string(),