/** * Settings that used to select a deployment mode, and the refusal they now produce. * * Skills once declared a three-way deployment axis as a label: running on this * machine, running against a server somebody operates, running against a * vendor-operated one. That axis is gone. Two facts replaced it, and both are read * from the configuration itself rather than from a declaration about it: * * - a server keeps its data in SQLite or in PostgreSQL, decided by the database * string it is given (see server/database-url.ts); * - a client either has an API origin configured or it does not (see * lib/api-url.ts). * * Deleting the label was not sufficient on its own, and this module is the half * that was left. A retired setting which is merely *unread* is the worse of the * two failures: an operator who exports a storage-mode variable gets a process on * the default SQLite database with no indication that the thing they configured * was discarded, and silence there is indistinguishable from success. That is how * a deployment ends up writing to a file nobody is backing up. So a retired * setting is refused, and the refusal names what replaced it. * * MATCHED BY SHAPE, NOT BY A LIST OF NAMES. The retired axis was spelled several * ways at once across the estate - two prefixes, and both `storage` and * `deployment` as the middle word - so enumerating the spellings we happen to * remember would let the next one through silently, which is the failure being * fixed. A suffix match catches every prefix variant, including ones this repo * never used itself. * * Two discriminations keep that shape from doing damage: * * - The suffixes are narrow. `*_MODE` alone would swallow live, unrelated * settings - SKILLS_TEST_MODE gates self-update in the suite, and SQLite's * journal mode is a mode - so only the three that named the removed * deployment axis appear below. Anything else called mode is a different axis * and none of this module's business. * - The match is scoped to this application's variables. Sibling Hasna apps are * mid-removal on the same axis and their variables are present in the same * shell; refusing to start because a *different* app still exports one would * turn this fix into an outage. The caller supplies the token that identifies * its own namespace. */ /** * Configuration-file keys that named the removed deployment axis, and the key * that replaces each one. * * A key is retired whatever its value: the fault is asking for a deployment label * at all, not asking for a particular one. Listing values instead would accept * `mode: "onprem"` while rejecting `mode: "cloud"`, which teaches the reader that * the concept survived and only some spellings of it are wrong. */ export declare const RETIRED_CONFIG_KEYS: Readonly>; /** Thrown when configuration names a setting the deployment-mode removal deleted. */ export declare class RetiredSettingError extends Error { readonly code = "RETIRED_SETTING"; /** The retired setting, spelled as the operator wrote it. */ readonly setting: string; constructor(setting: string, message: string); } /** * Whether an environment variable names the removed deployment axis for `app`. * * @param app token identifying the calling application's variable namespace, so * a sibling app's not-yet-removed variable is left alone. */ export declare function isRetiredModeEnvVar(name: string, app: string): boolean; /** * Every retired deployment-axis variable for `app` that is actually set. * * An empty string counts as unset. `export FOO="$BAR"` with BAR unset is what * collapses to that, and refusing it would fail a deployment over a value nobody * chose. */ export declare function findRetiredModeEnvVars(env: Record, app: string): { name: string; value: string; }[]; /** * Refuse if the environment names the removed deployment axis. * * `replacement` is supplied by the caller rather than hardcoded here so the name * stays owned by the module that reads it, and so this module needs no imports * and can be called from anywhere without an import cycle. * * @throws RetiredSettingError naming the retired variables, their replacement, * and the fix. */ export declare function assertNoRetiredModeEnvVars(env: Record, options: { app: string; replacement: string; }): void; /** * Refuse if a configuration object carries a retired deployment-axis key. * * @param source where the object came from - a file path, or the command that * supplied it - so the message points at the thing the operator has to change * rather than at "your configuration". * * @throws RetiredSettingError naming the retired key, its replacement, and the fix. */ export declare function assertNoRetiredConfigKeys(config: Record, source: string): void;