docs(config): document runtime profiles, deploy variables and precedence in README (13-15)
README said runtime settings live in public/config.json, which the build replaces with config/runtime/<profile>.json, and named none of APP_PROFILE, RUNTIME_*, VITE_BUILD_ID, RELEASE_ID or RELEASE_TARGET. A unit test now requires README to name every variable the generator and admission read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a55a15861e
commit
2ba880c7e2
@@ -23,11 +23,11 @@ import { makeDistFilesPublic } from "./lib/dist-permissions.ts";
|
||||
* Steps 5 and 6 are skipped for `REMOVE_REGISTRATION`, `PURGE_OWNED_RESOURCES`
|
||||
* and `null`: those modes never run an active worker build.
|
||||
*
|
||||
* Step 4 has to follow the Vite build and precede the asset scan. Vite copies
|
||||
* `public/` verbatim, so without it every build — including a production one —
|
||||
* ships the local runtime document; and the Service Worker hashes the emitted
|
||||
* `config.json`, so the profile must be in place before that inventory is
|
||||
* taken.
|
||||
* Step 4 has to follow the Vite build. Vite copies `public/` verbatim, so
|
||||
* without it every build — including a production one — ships the local
|
||||
* runtime document. The Service Worker asset scan excludes `config.json`
|
||||
* (`scripts/generate-service-worker-assets.ts`), so the order against step 5
|
||||
* is not what keeps the profile out of the worker cache (13-15).
|
||||
*/
|
||||
|
||||
const selection = INSTALLED_RUNTIME_CAPABILITIES.serviceWorker;
|
||||
|
||||
@@ -29,7 +29,7 @@ const OUTPUT_PATH = "dist/config.json";
|
||||
* Deployment-supplied values. Everything else is fixed by the profile so a
|
||||
* deployment cannot quietly widen what was reviewed.
|
||||
*/
|
||||
const OVERRIDES = Object.freeze({
|
||||
export const RUNTIME_OVERRIDES = Object.freeze({
|
||||
API_BASE_URL: "RUNTIME_API_BASE_URL",
|
||||
TELEMETRY_ENDPOINT: "RUNTIME_TELEMETRY_ENDPOINT",
|
||||
} as const);
|
||||
@@ -49,7 +49,7 @@ export async function generateRuntimeConfig(
|
||||
`${profilePath}: declares APP_ENV ${String(draft["APP_ENV"])}, expected ${target}`,
|
||||
);
|
||||
}
|
||||
for (const [field, variable] of Object.entries(OVERRIDES)) {
|
||||
for (const [field, variable] of Object.entries(RUNTIME_OVERRIDES)) {
|
||||
const supplied = environment[variable];
|
||||
if (supplied !== undefined && supplied !== "") draft[field] = supplied;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user