Skip to main content

o_sfu/config/
diagnostics.rs

1use anyhow::Result;
2
3use super::env::{Env, non_empty};
4
5#[derive(Debug, Clone, PartialEq, Eq, Default)]
6pub struct DiagnosticsConfig {
7    /// Bearer token required on every listener when configured.
8    pub auth_token: Option<String>,
9}
10
11impl DiagnosticsConfig {
12    pub(super) fn from_env(env: &Env<'_>) -> Result<Self> {
13        Ok(Self {
14            auth_token: env
15                .var("DIAGNOSTICS_AUTH_TOKEN")
16                .check(non_empty)
17                .optional()?,
18        })
19    }
20}
21
22#[cfg(test)]
23#[path = "TESTS/diagnostics.rs"]
24mod tests;