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

Method load

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

Load global configuration from the default location

()

Source from the content-addressed store, hash-verified

441impl GlobalConfig {
442 /// Load global configuration from the default location
443 pub fn load() -> Result<Self, ConfigError> {
444 let path = global_config_path().ok_or(ConfigError::NoConfigDir)?;
445
446 if !path.exists() {
447 return Ok(Self::default());
448 }
449
450 let content = std::fs::read_to_string(&path).map_err(|e| ConfigError::ReadError {
451 path: path.clone(),
452 source: e,
453 })?;
454
455 Ok(toml::from_str(&content)?)
456 }
457
458 /// Save global configuration to the default location
459 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