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

Method load

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

Load global configuration from the default location

()

Source from the content-addressed store, hash-verified

1071impl GlobalConfig {
1072 /// Load global configuration from the default location
1073 pub fn load() -> Result<Self, ConfigError> {
1074 let path = global_config_path().ok_or(ConfigError::NoConfigDir)?;
1075
1076 if !path.exists() {
1077 return Ok(Self::default());
1078 }
1079
1080 let content = std::fs::read_to_string(&path).map_err(|e| ConfigError::ReadError {
1081 path: path.clone(),
1082 source: e,
1083 })?;
1084
1085 Ok(toml::from_str(&content)?)
1086 }
1087
1088 /// Save global configuration to the default location
1089 pub fn save(&self) -> Result<(), ConfigError> {

Calls 3

global_config_pathFunction · 0.85
existsMethod · 0.45
cloneMethod · 0.45