rename to "MESSAGE_ENV_LABEL" for both push & SMS

This commit is contained in:
2026-10-15 19:44:00 -06:00
parent ce6111d72b
commit cdd84643db
5 changed files with 14 additions and 13 deletions
+5 -5
View File
@@ -26,6 +26,11 @@
# Leave off in production; the routes expose per-device state to any accepted JWT.
# DEBUG_ENDPOINT=false
# Appended as " (<label>)" to every SMS and push body, so a recipient can tell
# which server sent it. NODE_ENV cannot do this: the Docker image sets it to
# "production" everywhere. Unset or blank appends nothing.
# MESSAGE_ENV_LABEL=test
# --- SMS notifications (/notify-sms) ---
# Master switch. While false, every /notify-sms route returns 503 SMS_DISABLED
@@ -75,8 +80,3 @@
# sms_blocked_numbers table that the STOP webhook writes to. Normalized before
# comparison, so formatting does not defeat them.
# SMS_BLOCKED_NUMBERS=+15555550123,+15555550124
# Appended as " (<label>)" to every SMS and push body, so a recipient can tell
# which server sent it. NODE_ENV cannot do this: the Docker image sets it to
# "production" everywhere. Unset or blank appends nothing.
# SMS_ENV_LABEL=test
+3 -2
View File
@@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Optional `SMS_ENV_LABEL` appends ` (<label>)` to every SMS and push body, so a recipient can tell which server sent it; unset or blank appends nothing. `NODE_ENV` cannot serve, since the Docker image sets it to `production` on every server.
- Optional `MESSAGE_ENV_LABEL` appends ` (<label>)` to every SMS and push body, so a recipient can tell which server sent it; unset or blank appends nothing. `NODE_ENV` cannot serve, since the Docker image sets it to `production` on every server.
### Changed in DB or environment
- `SMS_ENV_LABEL` (see above) on test environment
- `MESSAGE_ENV_LABEL` (see above) on test environment
## [0.2.4] - 2026.10.13
### Changed
+1 -1
View File
@@ -738,7 +738,7 @@ Set `NOTIFY_DATA_DIR` to a durable directory, or keep the Docker default `/app/d
| `FIREBASE_SERVICE_ACCOUNT_JSON` **or** working ADC | **Required** for FCM (wakeup and AlertSearch) | ADC if JSON unset |
| `NOTIFY_DATA_DIR` | **Durable** path (or volume on `/app/data`) | `./data` (cwd-relative; in Docker that is `/app/data`) |
| `NODE_ENV` | Must **not** be `test-local` (that bypasses ethr JWT expiry) | Docker image sets `production` |
| `SMS_ENV_LABEL` | Optional; appended as ` (<label>)` to every SMS and push body. Leave unset in production, set it (e.g. `test`) elsewhere | Unset (nothing appended) |
| `MESSAGE_ENV_LABEL` | Optional; appended as ` (<label>)` to every SMS and push body. Leave unset in production, set it (e.g. `test`) elsewhere | Unset (nothing appended) |
| `SMS_ENABLED` | Optional; `/notify-sms` returns `503 SMS_DISABLED` while off | `false` |
| `SMS_CODE_SECRET` | **Required** when `SMS_ENABLED` (startup fails without it) | None |
| `TWILIO_ACCOUNT_SID`, `TWILIO_AUTH_TOKEN` | **Required** to send; absent means `SMS_NOT_CONFIGURED` per send | None |
+2 -2
View File
@@ -67,12 +67,12 @@ function stringEnv(name: string): string | undefined {
}
/**
* Appends " (<SMS_ENV_LABEL>)" to user-visible text, so a recipient can tell
* Appends " (<MESSAGE_ENV_LABEL>)" to user-visible text, so a recipient can tell
* which deployment sent it. NODE_ENV cannot serve: the Docker image fixes it to
* "production" on every server. Read per call, like smsConfig.
*/
export function withEnvLabel(text: string): string {
const label = process.env.SMS_ENV_LABEL?.trim();
const label = process.env.MESSAGE_ENV_LABEL?.trim();
return label ? `${text} (${label})` : text;
}
+3 -3
View File
@@ -5,7 +5,7 @@ import { smsConfig, withEnvLabel } from "../src/env.js";
const KEYS = [
"SMS_ENABLED",
"SMS_REQUIRE_ACTION_CLAIM",
"SMS_ENV_LABEL",
"MESSAGE_ENV_LABEL",
] as const;
const saved: Record<string, string | undefined> = {};
@@ -66,12 +66,12 @@ describe("smsConfig boolean flags", () => {
describe("withEnvLabel", () => {
it("leaves the text alone when unset or blank", () => {
assert.equal(withEnvLabel("hi"), "hi");
process.env.SMS_ENV_LABEL = " ";
process.env.MESSAGE_ENV_LABEL = " ";
assert.equal(withEnvLabel("hi"), "hi");
});
it("appends the trimmed label in parentheses", () => {
process.env.SMS_ENV_LABEL = " test ";
process.env.MESSAGE_ENV_LABEL = " test ";
assert.equal(withEnvLabel("hi"), "hi (test)");
});
});