Mail relay: development hosts are known by pattern, with no env - built in: *.dev.netscale.pl
The launch rule called a site non-public only when IAPL_NOINDEX was set (or the project named its hosts).
The owner's development sites set nothing, so production's database copied onto a development address
counted as a launch and would have mailed real people.
- iapl({ developmentHosts }): host patterns of development addresses. Default DEFAULT_DEVELOPMENT_HOSTS =
['*.dev.netscale.pl'], Intecion's own development domain; a project replaces the list or empties it.
mail.relay.developmentHosts overrides it for the mail service.
- a site whose host matches is non-public exactly as with IAPL_NOINDEX=1; either signal is enough
- siteNonPublicSignal, matchDevelopmentHost, isDevelopmentHost, pluginDevelopmentHosts exported
- panel state: nonPublicBy, nonPublicPattern; doctor: mail-non-public (info) names the signal
- every case of the launch table runs with no env on the built-in pattern
- 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
634908eb57
commit
14abf369da
+28
-10
@@ -262,8 +262,8 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
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'] } }`**
|
||||
tells the two apart by **direction**: a site that is **not public** — its host matches a development pattern, or
|
||||
`IAPL_NOINDEX=1` is set; either is enough (see "Which sites are non-public" below)
|
||||
— 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.
|
||||
@@ -272,7 +272,21 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
- **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.
|
||||
e-mail, on a development address too — clients test their forms there.
|
||||
|
||||
**Which sites are non-public.** No environment variable is needed:
|
||||
|
||||
- **By host, from code.** `iapl({ developmentHosts })` is a list of host patterns (`*` = any characters; the whole
|
||||
host must match). Its default is `DEFAULT_DEVELOPMENT_HOSTS` = **`['*.dev.netscale.pl']`**. That name is in the
|
||||
plugin on purpose: it is Intecion's own development domain, every site of the team is built at
|
||||
`<name>.dev.netscale.pl` before it moves to its real domain, and nothing in those sites' environments marks them
|
||||
as development copies — with the pattern built in they are protected without an edit. It is a default like any
|
||||
other: **replace it** with your own patterns (`developmentHosts: ['*.preview.agency.example', 'staging.client.pl']`),
|
||||
or pass **`[]`** so that no host is a development address. `mail: { relay: { developmentHosts } }` overrides the
|
||||
list for the mail service alone.
|
||||
- **By the variable.** `IAPL_NOINDEX=1` marks any other staging, preview or test copy.
|
||||
- The panel state (`nonPublicBy`, `nonPublicPattern`), `siteNonPublicSignal(payload)` and the doctor
|
||||
(`mail-non-public`) say which of the two applies.
|
||||
|
||||
| The site | Public? | Its database holds | By itself |
|
||||
|---|---|---|---|
|
||||
@@ -280,16 +294,20 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
| 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" |
|
||||
| staging / test copy of production on a development host, or with `IAPL_NOINDEX=1` | 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 |
|
||||
| a copy on a host **outside** the development patterns, without `IAPL_NOINDEX` | 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 copy on a host that matches no development pattern and has no `IAPL_NOINDEX=1` 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`). A project
|
||||
whose copies live elsewhere than `*.dev.netscale.pl` names its own patterns in `developmentHosts`.
|
||||
- A project that empties the list (`developmentHosts: []`) has only `IAPL_NOINDEX` left as a mark.
|
||||
- A **public** site served on a host that matches a development pattern is treated as a development address:
|
||||
it sends its own mail, but after a copy of another site's data it waits for "Connect again". Take the host out
|
||||
of the list.
|
||||
- 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").
|
||||
@@ -381,7 +399,7 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
|
||||
| `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` | `'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)`) |
|
||||
| `developmentHosts` | the plugin's list: `iapl({ developmentHosts })`, default `['*.dev.netscale.pl']` (`pluginDevelopmentHosts(payload)`) | host patterns (`*` = any characters) of development, staging and preview addresses, for the mail service alone: a site on such a host is non-public for `otherHosts`, like one with `IAPL_NOINDEX=1`, with no environment variable (`siteIsNonPublic`, `siteNonPublicSignal`, `matchDevelopmentHost`, `isDevelopmentHost`). `[]` = none |
|
||||
| `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