Skip to main content

resolve_and_reload

Function resolve_and_reload 

Source
pub fn resolve_and_reload(
    cfg: &mut Container,
    mgr: Option<&dyn Driver>,
    reader: &dyn DnsReader,
) -> Result<Container, ResolveError>
Expand description

Port of clusterdomain.ResolveAndReload: resolves the domain, then reloads the config so ${CAPRONI_CLUSTER_DOMAIN} expands with it.

The Go original relies on cfg.ClusterDomain and the GlobalConfig backing config.LoadFromContext(ctx) being the same mutable value (Resolve writes through a shared pointer that the ambient context also holds). This port’s global::Context holds an owned GlobalConfig snapshot instead (see xianyun-core’s own PORT_NOTES.md), so this function explicitly re-injects the resolved cfg.global into a fresh Context before reloading, achieving the same visible effect without relying on shared mutable state.