try load ./rusty-pipe.yaml if no $CONFIG_PATH

This commit is contained in:
Bel LaPointe
2023-03-24 13:59:10 -06:00
parent aacdbb3eb2
commit f69fb5163b
4 changed files with 14 additions and 6 deletions

View File

@@ -76,11 +76,13 @@ pub struct UDP {
}
pub fn build_config() -> Result<Config, String> {
let config_path = env::var("CONFIG_PATH");
match config_path {
match env::var("CONFIG_PATH") {
Ok(p) => return build_config_yaml(p),
Err(_) => return Ok(build_config_std()),
}
Err(_) => match build_config_yaml(String::from("./rusty-pipe.yaml")) {
Ok(v) => return Ok(v),
Err(_) => return Ok(build_config_std()),
},
};
}
fn build_config_yaml(path: String) -> Result<Config, String> {

View File

@@ -4,6 +4,7 @@ streams:
engine:
name: stdin
output:
format: 'rusty-pipe.yaml: {{ VALUE }}'
debug: true
engine:
name: stdout