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

Method resolve_server_mut

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

Resolve the effective server config mutably, honouring the optional name override. Mirrors the resolution order of [`resolve_server`](Self::resolve_server) so that writes (e.g. `atomic org set`, `atomic workspace set`) land on the same profile that reads resolve to: 1. `server_override` (from `--server ` CLI flag) 2. `default_server` (from `~/.atomic/config.toml`) 3. Legacy `server` block

(
        &mut self,
        server_override: Option<&str>,
    )

Source from the content-addressed store, hash-verified

338 /// Returns the mutable profile plus its name (`Some` for a named profile,
339 /// `None` for the legacy block).
340 pub fn resolve_server_mut(
341 &mut self,
342 server_override: Option<&str>,
343 ) -> Result<(&mut ServerConfig, Option<String>), String> {
344 // Determine which profile name to target, if any. We resolve the name
345 // first (immutable borrow) so the mutable borrow below is unambiguous.
346 let name = if let Some(name) = server_override {
347 Some(name.to_string())
348 } else {
349 self.default_server.clone()
350 };
351
352 match name {
353 Some(name) => {
354 let profile = self.servers.get_mut(&name).ok_or_else(|| {
355 format!(
356 "Server profile '{}' not found. \
357 Use 'atomic server list' to see available profiles, \
358 or 'atomic server add {0} <url>' to create it.",
359 name
360 )
361 })?;
362 Ok((profile, Some(name)))
363 }
364 None => Ok((&mut self.server, None)),
365 }
366 }
367
368 /// The active server profile's `agent_identity` binding, if any.
369 ///

Calls 2

get_mutMethod · 0.80
cloneMethod · 0.45