/** * Boolean environment-variable parsing. * * Why this exists (TD-1087): `.env.local` is generated by `vercel env pull`, and a * value authored in the Vercel store as `"true\n"` — a literal backslash-n inside * double quotes — is expanded by dotenv into a real trailing newline. The parsed * value is `'true\n'`, not `'true'`. * * Comparing that against a literal is silently wrong, and it is wrong in BOTH * directions depending on which operator the call site happened to use: * * 'true\n' === 'true' -> false feature you switched ON stays OFF * 'false\n' !== 'false' -> true switch you turned OFF stays ON * * The second direction is the dangerous one: it defeats off-switches. Which * direction a given flag failed in was decided by nothing more than whether * someone typed `===` or `!==` at that line — the default was encoded in the * operator, where it is invisible. * * `parseBool` takes the default as an explicit argument so that choice is stated * at every call site, and trims before comparing so whitespace can never decide * a flag. */ /** * Parse an environment-variable string into a boolean. * * Recognises `true` / `false` case-insensitively after trimming surrounding * whitespace. Anything else — undefined, empty, or an unrecognised word — yields * `defaultValue`. Unrecognised values deliberately do NOT coerce: silently * treating garbage as a boolean is the class of bug this function exists to end. * * @param raw the raw `process.env.X` value * @param defaultValue what to use when the value is absent or unrecognised */ export declare function parseBool(raw: string | undefined, defaultValue: boolean): boolean; /** * Report which of `keys` hold a value whose raw form differs from its trimmed * form — i.e. values carrying leading/trailing whitespace. * * `parseBool` makes such values harmless for booleans, but the same corruption * reaches values no boolean parser ever sees: a Sentry DSN with a trailing * newline does not parse as a DSN, and `NEXT_PUBLIC_*` keys are inlined into * client bundles verbatim at build time. This surfaces the class rather than * repairing one instance of it. * * Returns key names only. Values are never returned or logged — several of these * keys hold credentials. */ export declare function findWhitespacePaddedEnvKeys(keys: string[], env?: NodeJS.ProcessEnv): string[]; //# sourceMappingURL=env-bool.d.ts.map