MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / load

Method load

atomic-config/src/lib.rs:363–376  ·  view source on GitHub ↗

Load global configuration from the default location

()

Source from the content-addressed store, hash-verified

361impl GlobalConfig {
362 /// Load global configuration from the default location
363 pub fn load() -> Result<Self, ConfigError> {
364 let path = global_config_path().ok_or(ConfigError::NoConfigDir)?;
365
366 if !path.exists() {
367 return Ok(Self::default());
368 }
369
370 let content = std::fs::read_to_string(&path).map_err(|e| ConfigError::ReadError {
371 path: path.clone(),
372 source: e,
373 })?;
374
375 Ok(toml::from_str(&content)?)
376 }
377
378 /// Save global configuration to the default location
379 pub fn save(&self) -> Result<(), ConfigError> {

Callers 3

finishMethod · 0.45
runMethod · 0.45
peek_next_node_idMethod · 0.45

Calls 3

global_config_pathFunction · 0.85
existsMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected