aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorHazel Atkinson <yellowsink@riseup.net>2025-04-08 17:53:27 +0100
committerHazel Atkinson <yellowsink@riseup.net>2025-04-08 17:59:06 +0100
commit029a99ebcc2d9f4baab054d7262ebdcc45181b05 (patch)
treec038c1c64df3529d1e06aec5af35aef26c2b1a9e /src/config.rs
parentac323a2a89d6b8d7e511541911c5f5487f8a306a (diff)
downloadcontainerspy-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.rs25
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."
+ )))
+ }
})
}
}