From 09c8b4d5610df7aeade1dc0d9d7b71a74582410b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 5 Mar 2016 18:42:59 +0100 Subject: [PATCH] rt: Add Store::new() config passing --- libimagrt/src/configuration.rs | 7 +++++++ libimagrt/src/runtime.rs | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libimagrt/src/configuration.rs b/libimagrt/src/configuration.rs index f5f06662..71df589a 100644 --- a/libimagrt/src/configuration.rs +++ b/libimagrt/src/configuration.rs @@ -156,6 +156,13 @@ impl Configuration { &self.config } + pub fn store_config(&self) -> Option<&Value> { + match &self.config { + &Value::Table(ref tabl) => tabl.get("store"), + _ => None, + } + } + } fn get_verbosity(v: &Value) -> bool { diff --git a/libimagrt/src/runtime.rs b/libimagrt/src/runtime.rs index a1cbc63d..053fc408 100644 --- a/libimagrt/src/runtime.rs +++ b/libimagrt/src/runtime.rs @@ -68,7 +68,14 @@ impl<'a> Runtime<'a> { Some(cfg.unwrap()) }; - Store::new(storepath).map(|store| { + let store_config = { + match &cfg { + &Some(ref c) => c.store_config().map(|c| c.clone()), + _ => None + } + }; + + Store::new(storepath, store_config).map(|store| { Runtime { cli_matches: matches, configuration: cfg,