From f69fb5163b1f9a06436693b7f7d9601686e37b2b Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 24 Mar 2023 13:59:10 -0600 Subject: [PATCH] try load ./rusty-pipe.yaml if no $CONFIG_PATH --- rusty-pipe.yaml | 1 + src/config.rs | 10 ++++++---- src/testdata/config-stdin-to-stdout.yaml | 1 + todo.yaml | 8 ++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 120000 rusty-pipe.yaml diff --git a/rusty-pipe.yaml b/rusty-pipe.yaml new file mode 120000 index 0000000..b92963c --- /dev/null +++ b/rusty-pipe.yaml @@ -0,0 +1 @@ +src/testdata/config-stdin-to-stdout.yaml \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index 1681c7c..c24b8ea 100644 --- a/src/config.rs +++ b/src/config.rs @@ -76,11 +76,13 @@ pub struct UDP { } pub fn build_config() -> Result { - 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 { diff --git a/src/testdata/config-stdin-to-stdout.yaml b/src/testdata/config-stdin-to-stdout.yaml index 5d20d6b..1c7c79f 100644 --- a/src/testdata/config-stdin-to-stdout.yaml +++ b/src/testdata/config-stdin-to-stdout.yaml @@ -4,6 +4,7 @@ streams: engine: name: stdin output: + format: 'rusty-pipe.yaml: {{ VALUE }}' debug: true engine: name: stdout diff --git a/todo.yaml b/todo.yaml index fea4f80..0bf2b6f 100755 --- a/todo.yaml +++ b/todo.yaml @@ -1,6 +1,4 @@ todo: -- swapping input mappings by signals/multi mayhem process/whatever -- voice recognition substrings because fun - rate limiter in panic scenario - gotta stream keydown on more intervals - https://crates.io/crates/handlebars @@ -39,3 +37,9 @@ done: ts: Wed Mar 22 07:27:13 MDT 2023 - todo: gotta get keydown, keyup events into gui ts: Thu Mar 23 17:07:06 MDT 2023 +- todo: load default config if exists at ./rusty-pipe.yaml + ts: Fri Mar 24 13:58:56 MDT 2023 +- todo: swapping input mappings by signals/multi mayhem process/whatever + ts: Fri Mar 24 13:58:56 MDT 2023 +- todo: voice recognition substrings because fun + ts: Fri Mar 24 13:58:56 MDT 2023