UNPKG

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