Mail relay: launch and a domain move need no click; a non-public copy neither enrols nor sends by itself
The copy rule now goes by direction. A public site that finds another host's connection in its database (its development address after launch, its old domain after a move) enrols by itself. A site that says it is not public - IAPL_NOINDEX=1, or a host in the new mail.relay.developmentHosts - and holds another host's connection is a copy of that site's data: it neither enrols nor sends until "Connect again", also when it has a token of its own (production's database copied back onto the development address). The consent is stored with the copy (acceptedHosts), so the next fresh copy waits again. - mail.relay.otherHosts: 'auto' (default) | 'wait' | 'enrol' | list of the site's own hosts - mail.relay.developmentHosts, siteIsNonPublic() exported - the copy refusal ends when its reason does (no cool-down; the panel recomputes it on every read) - doctor: info for a public site whose database knows another host (the launched site, or a copy that forgot IAPL_NOINDEX) - contract copy 1.7.1 (wording only) - docs, AGENT.md, skills, changelog draft Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
acfcf72c03
commit
49927205bb
+50
-18
@@ -256,25 +256,56 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
|
||||
- **A site that passes the call-back is active at once** and can send. A staging site on its own domain is its own
|
||||
site to the service: its own enrolment, token and limits.
|
||||
- **A copy of production's database does not connect by itself.** Its data is production's — real customers'
|
||||
addresses in form submissions and accounts — and a copy that enrolled by itself would mail real people as soon
|
||||
as a form or a password reset ran. So a site whose database already holds the connection of **another host** and
|
||||
none of its own stays "not connected": sends report `relay-refused` (cause `client-other-host`), the state block
|
||||
says "The data comes from another site (…), so this site did not connect by itself", the doctor reports it
|
||||
(`mail-relay-state`), and no call leaves the server. An admin who wants the copy to send presses **Connect
|
||||
again**, once; from then on it is a site of its own and heals by itself.
|
||||
- **A site before launch is not affected:** with an empty store it enrols by itself on its first e-mail.
|
||||
- **A copy that must never send:** `iapl({ mail: { relay: false } })` there, or SMTP to a catcher. That is the
|
||||
safe set-up for staging; "not connected" only protects until somebody presses the button.
|
||||
- **`www.` and the bare domain** are one site: either enrols by itself beside the other (each keeps its own entry).
|
||||
- **A moved domain** (the same data under a new host) looks like a copy: after the move press **Connect again**
|
||||
once, or name the old host as the site's own — `mail: { relay: { otherHosts: ['old-domain.example'] } }` — and
|
||||
the site enrols by itself. The same list is for a second domain of one site.
|
||||
- **`otherHosts: 'enrol'`** switches the rule off: a site enrols by itself whatever else the database holds.
|
||||
- **Launch and a domain move need nobody.** A site is usually built and enrolled on a development address
|
||||
(`client.dev.agency.example`) and then served on its real domain, with the same data. The real domain finds the
|
||||
development address's connection in its database, treats it as its own past, enrols by itself on its first
|
||||
e-mail and sends. The same after a move to another domain. No button, no option.
|
||||
- **A non-public copy does not send by itself.** A copy of production's data holds real customers' addresses —
|
||||
form submissions, accounts — and would mail real people as soon as a form or a password reset ran. The plugin
|
||||
tells the two apart by **direction**: a site that says it is not public — **`IAPL_NOINDEX=1`** (every staging,
|
||||
preview and test copy sets it anyway) or a host matched by **`mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }`**
|
||||
— and whose database holds the connection of **another host** neither enrols nor sends: sends report
|
||||
`relay-refused` (cause `client-other-host`), the state block says "The data comes from another site (…), so this
|
||||
copy does not send e-mails by itself", the doctor reports it (`mail-relay-state`), and no call leaves the server.
|
||||
This also holds when the copy has a token of its own: production's database copied **back** onto the development
|
||||
address brings that address's old connection with it, and still mails nobody.
|
||||
- **An admin who wants the copy to send** presses **Connect again**, once. That is stored in the copy's database;
|
||||
the next fresh copy of production replaces it and waits again.
|
||||
- **A site before launch is not affected:** with no other host in its database it enrols by itself on its first
|
||||
e-mail, noindex or not.
|
||||
|
||||
| The site | Public? | Its database holds | By itself |
|
||||
|---|---|---|---|
|
||||
| on its development address, before launch | no | nothing, or only its own connection | enrols and sends |
|
||||
| on the real domain, launch day (the development site may still run on its own database) | yes | the development address's connection | **enrols and sends — no click** |
|
||||
| after a domain move; a second domain | yes | the old domain's connection | enrols and sends |
|
||||
| `www.` and the bare domain | either | each other's | one site: both send, each with its own entry |
|
||||
| staging / test copy of production (`IAPL_NOINDEX=1` or a development host) | no | production's connection | **sends nothing** until "Connect again" |
|
||||
| production's database copied back onto the development address | no | production's and its own old one | **sends nothing** until "Connect again" |
|
||||
| a developer's `localhost` on the production database | — | production's | refused before any call (not a public host); reads and writes nothing of production's |
|
||||
| a copy that **forgot** `IAPL_NOINDEX` and is on no development host | yes | production's | **enrols and sends, to the real addresses in its data** — see below |
|
||||
|
||||
- **What remains possible — say it to whoever sets up a copy:**
|
||||
- A copy that does not say it is not public (no `IAPL_NOINDEX=1`, host not in `developmentHosts`) looks exactly
|
||||
like launch day and **sends**. The doctor's deep run reports the only sign there is, as information: "the
|
||||
database also holds the mail-service connection of another host, and this site is public" (`mail-relay-state`).
|
||||
Projects that put every copy under one pattern should set `developmentHosts` once, in the shared config.
|
||||
- A production site that still has `IAPL_NOINDEX=1` after launch counts as non-public: it finds the development
|
||||
address's connection and **sends nothing** (and is not indexed either). The state block and the doctor say why;
|
||||
removing the variable is the fix ([deployment.md](./deployment.md): "`IAPL_NOINDEX` NOT set in production").
|
||||
- A copy that keeps production's `serverURL` is the same site to the plugin (and to the service, if it can be
|
||||
called back at that host).
|
||||
- After "Connect again" a copy sends until its data is replaced.
|
||||
- A development site that keeps running **on the launched database** (not a copy of it) stops sending by itself
|
||||
once the real domain has enrolled; other processes notice within 30 seconds.
|
||||
- **A copy that must never send:** `iapl({ mail: { relay: false } })` there, or SMTP to a catcher. That is the safe
|
||||
set-up for staging; the rule above only protects until somebody presses the button.
|
||||
- **`otherHosts`** changes the rule: a list (`['client.dev.agency.example']`) names hosts as this site's own — a
|
||||
non-public site is not held by them, and the doctor's note about a launched site goes away; `'wait'` is the
|
||||
stricter rule — also a public site without a connection of its own waits for "Connect again"; `'enrol'` switches
|
||||
the rule off.
|
||||
- Production's connection is never used, changed or revoked by a copy — "Disconnect" on a copy included, and on the
|
||||
same server too. A developer's process on `localhost` reading the live database changes nothing either.
|
||||
- Not covered: a copy that keeps production's `serverURL` is the same site to the plugin (and to the service, if it
|
||||
can be called back at that host).
|
||||
|
||||
### The state block in the panel
|
||||
|
||||
@@ -349,7 +380,8 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
|
||||
| `relay: false` | — | switches the mail service off: no enrolment, no outbound call, no confirm route, no state block, the panel wording of 1.16 |
|
||||
| `url` | `RELAY_BASE_URL` (`https://webservices.intecion.net/mail`) | another base address — a relay of your own that speaks the same contract |
|
||||
| `host` | host of `serverURL` (`relayHost(payload, options)`) | the public host the service calls back |
|
||||
| `otherHosts` | `'wait'` | a database that holds another host's connection and none of this site's (a copy, a moved domain): `'wait'` = no enrolment until "Connect again"; a list = those hosts are this site's own; `'enrol'` = enrol by itself anyway |
|
||||
| `otherHosts` | `'auto'` | a database that holds another host's connection. `'auto'`: a public site enrols by itself (launch, a domain move); a non-public one (`IAPL_NOINDEX=1` or `developmentHosts`) neither enrols nor sends until "Connect again". A list = those hosts are this site's own. `'wait'` = a public site without a connection of its own waits too. `'enrol'` = no rule |
|
||||
| `developmentHosts` | `[]` | host patterns (`*` = any characters) of development, staging and preview addresses, for example `['*.dev.agency.example']`: a site on such a host is non-public for `otherHosts`, like one with `IAPL_NOINDEX=1` (`siteIsNonPublic(payload, options)`) |
|
||||
| `enrol` | `'auto'` | `'manual'`: only "Connect again" or `enrolRelay()` enrols. `false`: never (the token comes from `token` or `setRelayToken`) |
|
||||
| `accessKeyField` | `false` | `true` shows "Enter an access key" in the state block and lets its route store a hand-issued token an admin pastes |
|
||||
| `token` | — | a token from elsewhere (`string` or a function): the stored token is not used and the site does not enrol |
|
||||
|
||||
Reference in New Issue
Block a user