MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / from_env

Method from_env

src/sessions/codex_app_server.rs:46–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45impl CodexAppServerSummaryConfig {
46 pub fn from_env() -> Self {
47 let mut config = Self::default();
48 if let Some(bin) = non_empty_env("TRACEDECAY_CODEX_BIN") {
49 config.codex_bin = bin;
50 }
51 if let Some(model) = non_empty_env("TRACEDECAY_CODEX_SUMMARY_MODEL") {
52 config.model = Some(model);
53 }
54 if let Some(secs) = non_empty_env("TRACEDECAY_CODEX_SUMMARY_TIMEOUT_SECS")
55 .and_then(|secs| secs.parse::<u64>().ok())
56 {
57 config.timeout = Duration::from_secs(secs.clamp(5, 300));
58 }
59 if let Some(max_tokens) =
60 non_empty_env("TRACEDECAY_CODEX_SUMMARY_MAX_TOKENS").and_then(|value| {
61 value
62 .parse::<u32>()
63 .ok()
64 .filter(|max_tokens| *max_tokens > 0)
65 })
66 {
67 config.max_tokens = Some(max_tokens);
68 }
69 if let Some(temperature) =
70 non_empty_env("TRACEDECAY_CODEX_SUMMARY_TEMPERATURE").and_then(|value| {
71 value
72 .parse::<f32>()
73 .ok()
74 .filter(|temperature| temperature.is_finite() && *temperature >= 0.0)
75 })
76 {
77 config.temperature = Some(temperature);
78 }
79 config
80 }
81}
82
83fn non_empty_env(name: &str) -> Option<String> {

Callers

nothing calls this directly

Calls 1

non_empty_envFunction · 0.70

Tested by

no test coverage detected