|
| 1 | +/// <reference types="dotenv" /> |
| 2 | + |
| 3 | +/** |
| 4 | + * The result of a call to load() or parse() |
| 5 | + */ |
| 6 | +export interface IEnvironmentMap { |
| 7 | + [name: string]: string; |
| 8 | +} |
| 9 | + |
| 10 | +/** |
| 11 | + * DotenvExtended options for load(). |
| 12 | + */ |
| 13 | +export interface IDotenvExtendedOptions { |
| 14 | + /** |
| 15 | + * Sets the encoding of the .env files. |
| 16 | + * |
| 17 | + * @default 'utf-8' |
| 18 | + */ |
| 19 | + encoding?: string; |
| 20 | + |
| 21 | + /** |
| 22 | + * Sets whether a log message is shown when missing the .env or .env.defaults files. |
| 23 | + * |
| 24 | + * @default true |
| 25 | + */ |
| 26 | + silent?: boolean; |
| 27 | + |
| 28 | + /** |
| 29 | + * Path to the main .env file that contains your variables. |
| 30 | + * |
| 31 | + * @default '.env' |
| 32 | + */ |
| 33 | + path?: string; |
| 34 | + |
| 35 | + /** |
| 36 | + * The path to the file that default values are loaded from. |
| 37 | + * |
| 38 | + * @default '.env.defaults' |
| 39 | + */ |
| 40 | + defaults?: string; |
| 41 | + |
| 42 | + /** |
| 43 | + * The path to the file that contains the schema of what values should be available |
| 44 | + * from combining .env and .env.defaults. |
| 45 | + * |
| 46 | + * @default '.env.schema' |
| 47 | + */ |
| 48 | + schema?: string; |
| 49 | + |
| 50 | + /** |
| 51 | + * Causes the library to throw a MISSING CONFIG VALUES error listing all of the variables |
| 52 | + * missing the combined .env and .env.defaults files. |
| 53 | + * |
| 54 | + * @default false |
| 55 | + */ |
| 56 | + errorOnMissing?: boolean; |
| 57 | + |
| 58 | + /** |
| 59 | + * Causes the library to throw a EXTRA CONFIG VALUES error listing all of the extra variables |
| 60 | + * from the combined .env and .env.defaults files. |
| 61 | + * |
| 62 | + * @default false |
| 63 | + */ |
| 64 | + errorOnExtra?: boolean; |
| 65 | + |
| 66 | + /** |
| 67 | + * Sets whether the loaded values are assigned to the process.env object. |
| 68 | + * If this is set, you must capture the return value of the call to .load() or you will not be |
| 69 | + * able to use your variables. |
| 70 | + * |
| 71 | + * @default true |
| 72 | + */ |
| 73 | + assignToProcessEnv?: boolean; |
| 74 | + |
| 75 | + /** |
| 76 | + * By defaut, dotenv-entended will not overwrite any varibles that are already set in the process.env object. |
| 77 | + * If you would like to enable overwriting any already existing values, set this value to true. |
| 78 | + * |
| 79 | + * @default false |
| 80 | + */ |
| 81 | + overrideProcessEnv?: boolean; |
| 82 | +} |
| 83 | + |
| 84 | +export { parse } from 'dotenv'; |
| 85 | + |
| 86 | +/** |
| 87 | + * Loads the dotenv files, .env, .env.defaults and .env.schema. |
| 88 | + * |
| 89 | + * @param options |
| 90 | + */ |
| 91 | +export function load(options?: IDotenvExtendedOptions): IEnvironmentMap; |
0 commit comments