Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
macro_service_urls
What it is
Belongs to shared infrastructure: typed per-environment URLs for every Macro
service and gateway, resolved from macro_env::Environment with an
OVERRIDE_<NAME> env var escape hatch.
Start here
src/lib.rs: theservice_url!macro and theServiceUrlscollection — the whole crate is this one file plus its macro-generated types.src/test.rs: override-resolution tests; also shows the macro's expected usage.
Scope
- Owns: the
local/dev/proddefault for every service URL, theOVERRIDE_*env var convention, and theServiceUrl<'a>string wrapper. - Not here: the URL value itself used outside Rust →
infra/packages/shared/src/service_urls.ts,apps/web/src/lib/core/constant/servers.ts,packages/sdk/src/config.ts(hand-kept in sync; see the config rule).
Boundaries
- Depends on:
macro_env(forEnvironment). - Used by: nearly every Rust service that calls another service — construct a
type with
XServiceUrl::new(), never a raw string or env var.
Recipes
- Add a new service URL: add a field to the
service_url! { struct ServiceUrls { ... } }block insrc/lib.rswithlocal/dev/prodvalues, then update the other three copies of the table (see Related).
Checks
cargo test -p macro_service_urls(SQLX_OFFLINEunset).
Agent service URLs
Cognition, scheduling, preview control, and public MCP have distinct API base
paths but share the agent harness process. McpPublicUrl and
CognitionPublicUrl separately preserve the registered public OAuth identities;
do not substitute the internal API routes when building callbacks. Their direct local defaults use
port 8101 with /cognition, /scheduled-action, /preview, and the MCP base
at the root. Gateway paths remain unchanged.
Gotchas
- The override env var name is derived from the struct name
(
CalendarServiceUrl→OVERRIDE_CALENDAR_SERVICE_URL); renaming a struct silently changes what override callers must set. localdefaults are host ports, not Docker-network addresses; a service calling another from inside Docker needs anOVERRIDE_*_URLentry inlocal_env.rs, not a differentlocaldefault here.
Related
- Rules:
.agents/rules/config-and-service-urls.md· Docs:docs/guides/new-service.md(§5 Service discovery)