diff options
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index 3b92dd8..95c1a18 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -24,6 +24,8 @@ pub struct Config { | |||
| 24 | /// Piper voice name, used to resolve the model file when `tts_model_path` | 24 | /// Piper voice name, used to resolve the model file when `tts_model_path` |
| 25 | /// points at a directory. Ignored when it points at a `.onnx` file directly. | 25 | /// points at a directory. Ignored when it points at a `.onnx` file directly. |
| 26 | pub tts_voice: String, | 26 | pub tts_voice: String, |
| 27 | pub recording_enabled: bool, | ||
| 28 | pub recording_window_seconds: u64, | ||
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | struct EnvVar { | 31 | struct EnvVar { |
| @@ -124,6 +126,18 @@ const ENV_VARS: &[EnvVar] = &[ | |||
| 124 | default: Some("info"), | 126 | default: Some("info"), |
| 125 | description: "tracing/logging level filter", | 127 | description: "tracing/logging level filter", |
| 126 | }, | 128 | }, |
| 129 | EnvVar { | ||
| 130 | name: "RECORDING_ENABLED", | ||
| 131 | required: false, | ||
| 132 | default: Some("true"), | ||
| 133 | description: "enable continuous voice recording while in a VC (set false to opt out)", | ||
| 134 | }, | ||
| 135 | EnvVar { | ||
| 136 | name: "RECORDING_WINDOW_SECONDS", | ||
| 137 | required: false, | ||
| 138 | default: Some("900"), | ||
| 139 | description: "rolling recording buffer length in seconds (memory ~sample_rate*2 bytes/sec)", | ||
| 140 | }, | ||
| 127 | ]; | 141 | ]; |
| 128 | 142 | ||
| 129 | pub fn check_env_vars() { | 143 | pub fn check_env_vars() { |
| @@ -186,6 +200,14 @@ impl Config { | |||
| 186 | .ok() | 200 | .ok() |
| 187 | .and_then(|v| v.parse().ok()), | 201 | .and_then(|v| v.parse().ok()), |
| 188 | assistant_keyword: env::var("ASSISTANT_KEYWORD").unwrap_or_else(|_| "jarvis".into()), | 202 | assistant_keyword: env::var("ASSISTANT_KEYWORD").unwrap_or_else(|_| "jarvis".into()), |
| 203 | recording_enabled: env::var("RECORDING_ENABLED") | ||
| 204 | .unwrap_or_else(|_| "true".into()) | ||
| 205 | .parse() | ||
| 206 | .unwrap_or(true), | ||
| 207 | recording_window_seconds: env::var("RECORDING_WINDOW_SECONDS") | ||
| 208 | .unwrap_or_else(|_| "900".into()) | ||
| 209 | .parse() | ||
| 210 | .unwrap_or(900), | ||
| 189 | copyparty_url: env::var("COPYPARTY_URL") | 211 | copyparty_url: env::var("COPYPARTY_URL") |
| 190 | .unwrap_or_else(|_| "http://localhost:3939".into()), | 212 | .unwrap_or_else(|_| "http://localhost:3939".into()), |
| 191 | copyparty_url_upload: env::var("COPYPARTY_URL_UPLOAD") | 213 | copyparty_url_upload: env::var("COPYPARTY_URL_UPLOAD") |
