await domain.attach({ host: "hst_7f2" }); // example.com
await domain.attach({ host: "hst_7f2", name: "app" }); // app.example.com
await domain.attachments();
// [{ name: "example.com", host: "hst_7f2", kind: "site", label: "Showcase",
// url: "https://example.com", status: "live", attachedAt: "…" }]
await domain.detach({ name: "app" });domain.attach(host="hst_7f2") # example.com
domain.attach(host="hst_7f2", name="app") # app.example.com
domain.attachments()
# [{"name": "example.com", "host": "hst_7f2", "kind": "site", "label": "Showcase",
# "url": "https://example.com", "status": "live", "attachedAt": "…"}]
domain.detach(name="app")hoststringrequiredThe host identifier, from api.hosts.
namestringoptionalA name under the zone. Left out, the root is attached.
Attaching is two halves, and you get both
A serving name needs the DNS record and the recognition of that name by whatever answers it. This call goes through the same write path as host.domains.attach(): one plumbing, two points of view — from the domain, or from the host.
Not the same thing as serve()
serve() points a name at a project of the account; attach() points it at a host created with api.hosts. Two targets, not two names for one thing — and a name set up with serve() does not appear in attachments(), which reads what the hosts carry.
The address answers once the certificate is active
A fresh name takes from seconds to several minutes to get one, and the connection is refused until then. tls() says where each attached name stands.