Skip to content

createEnvLookup

createEnvLookup(source?): EnvLookup

Defined in: create-env-lookup.ts:23

Create a lightweight env lookup backed by a fixed source dict or, when called with no arguments, by a lazy read of process.env on every call.

Use the no-arg form for the application singleton — it always reflects the current state of process.env so tests can mutate it freely:

Record<string, string | undefined>

EnvLookup

// singleton — reads process.env lazily
export const env = createEnvLookup();
// injectable — tests pass a fake dict
export function makeEnv(source?: Record<string, string | undefined>) {
return createEnvLookup(source);
}