MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / load_from_file

Method load_from_file

crates/opencode-provider/src/auth.rs:77–87  ·  view source on GitHub ↗
(data_dir: &Path)

Source from the content-addressed store, hash-verified

75 }
76
77 pub async fn load_from_file(data_dir: &Path) -> Self {
78 let filepath = data_dir.join("auth.json");
79 let manager = Self::with_filepath(filepath.clone());
80 if let Ok(content) = tokio::fs::read_to_string(&filepath).await {
81 if let Ok(data) = serde_json::from_str::<HashMap<String, AuthInfo>>(&content) {
82 let mut creds = manager.credentials.write().await;
83 *creds = data;
84 }
85 }
86 manager
87 }
88
89 pub async fn get(&self, provider_id: &str) -> Option<AuthInfo> {
90 let creds = self.credentials.read().await;

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected