forked from DefinitelyTyped/DefinitelyTyped
/
index.d.ts
53 lines (45 loc) · 1.35 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Type definitions for dotenv-safe 8.1
// Project: https://github.com/rolodato/dotenv-safe
// Definitions by: Stan Goldmann <https://github.com/krenor>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import dotenv = require('dotenv');
export interface MissingEnvVarsError extends Error {
/**
* Path to example environment file.
*/
sample: string;
/**
* Variables which existing in the sample file, but not in the loaded file.
*/
missing: string[];
}
export interface DotenvSafeOptions extends dotenv.DotenvConfigOptions {
/**
* Path to example environment file. (Option 1)
* @default ".env.example"
*/
example?: string;
/**
* Path to example environment file. (Option 2 -- example takes precedence)
* @default ".env.example"
*/
sample?: string;
/**
* Enabling this option will not throw an error after loading.
* @default false
*/
allowEmptyValues?: boolean;
}
export interface DotenvSafeConfigOutput extends dotenv.DotenvConfigOutput {
/**
* key-value pairs required by .env.example
*/
required: dotenv.DotenvParseOutput;
}
/**
* Loads environment variables file into 'process.env'.
*
* @throws MissingEnvVarsError
*/
export function config(options?: DotenvSafeOptions): DotenvSafeConfigOutput;