diff options
| author | Hazel Atkinson <yellowsink@riseup.net> | 2025-04-08 17:53:27 +0100 |
|---|---|---|
| committer | Hazel Atkinson <yellowsink@riseup.net> | 2025-04-08 17:59:06 +0100 |
| commit | 029a99ebcc2d9f4baab054d7262ebdcc45181b05 (patch) | |
| tree | c038c1c64df3529d1e06aec5af35aef26c2b1a9e /src/config.rs | |
| parent | ac323a2a89d6b8d7e511541911c5f5487f8a306a (diff) | |
| download | containerspy-029a99ebcc2d9f4baab054d7262ebdcc45181b05.tar.gz containerspy-029a99ebcc2d9f4baab054d7262ebdcc45181b05.tar.bz2 containerspy-029a99ebcc2d9f4baab054d7262ebdcc45181b05.zip | |
prepare codebase for beta 1 release
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/config.rs b/src/config.rs index 212ca64..0cd9019 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,16 +21,14 @@ pub struct CspyConfig { pub static CONFIG: LazyLock<CspyConfig> = LazyLock::new(|| { let cfg_loc = std::env::var("CSPY_CONFIG"); - let cfg_loc = cfg_loc.as_deref().ok().unwrap_or("/etc/containerspy/config.json"); + let cfg_loc = cfg_loc + .as_deref() + .ok() + .unwrap_or("/etc/containerspy/config.json"); - CspyConfig::builder() - .env() - .file(cfg_loc) - .load() - .unwrap() + CspyConfig::builder().env().file(cfg_loc).load().unwrap() }); - /// deserialization boilerplate struct ProtoDeserVisitor; @@ -43,13 +41,18 @@ impl confique::serde::de::Visitor<'_> for ProtoDeserVisitor { } fn visit_str<E>(self, v: &str) -> std::result::Result<Self::Value, E> - where - E: confique::serde::de::Error, { - Ok(match v { + where + E: confique::serde::de::Error, + { + Ok(match v { "httpbinary" => Protocol::HttpBinary, "httpjson" => Protocol::HttpJson, "grpc" => Protocol::Grpc, - &_ => return Err(E::custom(format!("{v} is not a valid OTLP protocol, valid options are httpbinary, httpjson, or grpc."))) + &_ => { + return Err(E::custom(format!( + "{v} is not a valid OTLP protocol, valid options are httpbinary, httpjson, or grpc." + ))) + } }) } } |
