MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / load_from_file

Method load_from_file

crates/openshell-router/src/config.rs:81–95  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

79
80impl RouterConfig {
81 pub fn load_from_file(path: &Path) -> Result<Self, RouterError> {
82 let content = std::fs::read_to_string(path).map_err(|e| {
83 RouterError::Internal(format!(
84 "failed to read router config {}: {e}",
85 path.display()
86 ))
87 })?;
88 let config: Self = serde_yml::from_str(&content).map_err(|e| {
89 RouterError::Internal(format!(
90 "failed to parse router config {}: {e}",
91 path.display()
92 ))
93 })?;
94 config.resolve()
95 }
96
97 fn resolve(self) -> Result<Self, RouterError> {
98 // Validate that all routes can resolve their API keys

Callers

nothing calls this directly

Calls 1

resolveMethod · 0.45

Tested by

no test coverage detected