mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-15 13:22:46 +00:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
// 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,
|
|
}
|
|
|
|
/**
|
|
* Loads environment variables file into 'process.env'.
|
|
*
|
|
* @throws MissingEnvVarsError
|
|
*/
|
|
export function config(options?: DotenvSafeOptions): dotenv.DotenvConfigOutput
|