Add store path configuration

This commit is contained in:
Matthias Beyer 2015-10-26 23:56:54 +01:00
parent 099d63f13a
commit 754ad0c6cb

View file

@ -11,6 +11,7 @@ use config::types::ScalarValue as S;
pub struct Configuration {
pub rtp : String,
pub store_sub : String,
pub verbose : bool,
pub debugging : bool,
}
@ -22,6 +23,7 @@ impl Configuration {
let mut verbose = false;
let mut debugging = false;
let mut store_sub = String::from("/store");
if let Some(cfg) = fetch_config(&rtp) {
if let Some(v) = cfg.lookup_boolean("verbose") {
@ -30,11 +32,15 @@ impl Configuration {
if let Some(d) = cfg.lookup_boolean("debug") {
debugging = d;
}
if let Some(s) = cfg.lookup_str("store") {
store_sub = String::from(s);
}
}
Configuration {
verbose: verbose,
debugging: debugging,
store_sub: store_sub,
rtp: rtp,
}
}
@ -47,6 +53,10 @@ impl Configuration {
self.debugging
}
pub fn store_path_str(&self) -> String {
format!("{}{}", self.rtp, self.store_sub)
}
}
fn rtp_path(config: &Config) -> String {