UNPKG

2.12 kBTypeScriptView Raw
1import { ConfigFactory } from './config-factory.interface';
2import { DotenvExpandOptions } from 'dotenv-expand';
3/**
4 * @publicApi
5 */
6export interface ConfigModuleOptions {
7 /**
8 * If "true", values from the process.env object will be cached in the memory.
9 * This improves the overall application performance.
10 * See: https://github.com/nodejs/node/issues/3104
11 */
12 cache?: boolean;
13 /**
14 * If "true", registers `ConfigModule` as a global module.
15 * See: https://docs.nestjs.com/modules#global-modules
16 */
17 isGlobal?: boolean;
18 /**
19 * If "true", environment files (`.env`) will be ignored.
20 */
21 ignoreEnvFile?: boolean;
22 /**
23 * If "true", predefined environment variables will not be validated.
24 */
25 ignoreEnvVars?: boolean;
26 /**
27 * Path to the environment file(s) to be loaded.
28 */
29 envFilePath?: string | string[];
30 /**
31 * Custom function to validate environment variables. It takes an object containing environment
32 * variables as input and outputs validated environment variables.
33 * If exception is thrown in the function it would prevent the application from bootstrapping.
34 * Also, environment variables can be edited through this function, changes
35 * will be reflected in the process.env object.
36 */
37 validate?: (config: Record<string, any>) => Record<string, any>;
38 /**
39 * Environment variables validation schema (Joi).
40 */
41 validationSchema?: any;
42 /**
43 * Schema validation options.
44 * See: https://joi.dev/api/?v=17.3.0#anyvalidatevalue-options
45 */
46 validationOptions?: Record<string, any>;
47 /**
48 * Array of custom configuration files to be loaded.
49 * See: https://docs.nestjs.com/techniques/configuration
50 */
51 load?: Array<ConfigFactory>;
52 /**
53 * A boolean value indicating the use of expanded variables, or object
54 * containing options to pass to dotenv-expand.
55 * If .env contains expanded variables, they'll only be parsed if
56 * this property is set to true.
57 */
58 expandVariables?: boolean | DotenvExpandOptions;
59}