rt: Add Store::new() config passing

This commit is contained in:
Matthias Beyer 2016-03-05 18:42:59 +01:00
parent feac9ae9e8
commit 09c8b4d561
2 changed files with 15 additions and 1 deletions

View file

@ -156,6 +156,13 @@ impl Configuration {
&self.config &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 { fn get_verbosity(v: &Value) -> bool {

View file

@ -68,7 +68,14 @@ impl<'a> Runtime<'a> {
Some(cfg.unwrap()) 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 { Runtime {
cli_matches: matches, cli_matches: matches,
configuration: cfg, configuration: cfg,