diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 01:12:58 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 01:12:58 +0100 |
| commit | 91d51e9f7382ea01d69b2e21452d4de56fefec8d (patch) | |
| tree | 87113f53f9b30631fc9697ba4ab939cb2b7fa386 /src/config.rs | |
| parent | cron/triggers: keep pre-scoping rows manageable (diff) | |
| download | senator-sperma-91d51e9f7382ea01d69b2e21452d4de56fefec8d.tar.gz senator-sperma-91d51e9f7382ea01d69b2e21452d4de56fefec8d.zip | |
recording: reject a zero-length window
Diffstat (limited to '')
| -rw-r--r-- | src/config.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/config.rs b/src/config.rs index 95c1a18..e55226c 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -205,8 +205,11 @@ impl Config { | |||
| 205 | .parse() | 205 | .parse() |
| 206 | .unwrap_or(true), | 206 | .unwrap_or(true), |
| 207 | recording_window_seconds: env::var("RECORDING_WINDOW_SECONDS") | 207 | recording_window_seconds: env::var("RECORDING_WINDOW_SECONDS") |
| 208 | .unwrap_or_else(|_| "900".into()) | 208 | .ok() |
| 209 | .parse() | 209 | .and_then(|value| value.parse::<u64>().ok()) |
| 210 | // 0 would divide by zero in the mixer; cap the ring so a typo | ||
| 211 | // cannot allocate an unbounded amount of memory. | ||
| 212 | .filter(|seconds| (1..=3600).contains(seconds)) | ||
| 210 | .unwrap_or(900), | 213 | .unwrap_or(900), |
| 211 | copyparty_url: env::var("COPYPARTY_URL") | 214 | copyparty_url: env::var("COPYPARTY_URL") |
| 212 | .unwrap_or_else(|_| "http://localhost:3939".into()), | 215 | .unwrap_or_else(|_| "http://localhost:3939".into()), |
