@nestjs/config
Version:
Configuration for NestJS: load .env files and custom configuration, validate it at startup, and read it through an injectable ConfigService.
32 lines (31 loc) • 1.28 kB
TypeScript
/**
* Validated environment variables served by `ConfigService#get`, one layer
* per `ConfigModule.forRoot()` call. A layer holds the validator's output as
* is, so that the members of a class instance it returns keep working.
*/
export declare class ValidatedEnv {
private readonly layers;
add(values: Record<string, any>, hiddenKeys: Set<string>, convertedKeys: Set<string>): void;
/**
* Resolves a property path. "found" with an `undefined` value means that
* the validator removed the variable.
*/
resolve(path: PropertyKey): {
found: boolean;
value: unknown;
};
/**
* Replaces the value of a variable that is a string (a value converted by
* validation, e.g. to a number, is not replaced, it isn't validated again).
* The variable name is used as is, never as a path.
*/
update(key: string, value: string): void;
/**
* Returns the layers that may serve a path, in the order they are tried:
* the ones that converted it (the last first), then all of them in the
* order they were added. So a value a validator only passed through (e.g.
* the raw form of a variable another validator converted) doesn't replace a
* converted one.
*/
private getLayers;
}