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

Method load

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

Load global configuration from the default location

()

Source from the content-addressed store, hash-verified

379impl GlobalConfig {
380 /// Load global configuration from the default location
381 pub fn load() -> Result<Self, ConfigError> {
382 let path = global_config_path().ok_or(ConfigError::NoConfigDir)?;
383
384 if !path.exists() {
385 return Ok(Self::default());
386 }
387
388 let content = std::fs::read_to_string(&path).map_err(|e| ConfigError::ReadError {
389 path: path.clone(),
390 source: e,
391 })?;
392
393 Ok(toml::from_str(&content)?)
394 }
395
396 /// Save global configuration to the default location
397 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