Skip to main content

write_daemon_addr

Function write_daemon_addr 

Source
pub fn write_daemon_addr(app_name: &str, addr: &str) -> Result<()>
Expand description

Write the daemon’s bound HTTP address to the app’s data directory.

Why: Both trusty-search and trusty-memory persist their bound host:port to disk so MCP clients (and follow-up CLI invocations) can discover where the daemon ended up after auto-port-walking. Centralising the path layout keeps the two projects in sync and prevents a third trusty-* daemon from inventing yet another location. What: writes addr verbatim (no trailing newline) to {resolve_data_dir(app_name)}/http_addr, creating the directory if it doesn’t yet exist. Atomic-overwrite semantics aren’t required — the file is rewritten on every daemon start. Test: daemon_addr_round_trips writes then reads under a stubbed HOME and confirms equality.