mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
As per the code for the library it allows for a `example` or `sample` option. The `example` option is currently missing and what is documented in the library documentation. Code: https://github.com/rolodato/dotenv-safe/blob/master/index.js#L24
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
// Type definitions for dotenv-safe 5.0
|
|
// Project: https://github.com/rolodato/dotenv-safe
|
|
// Definitions by: Stan Goldmann <https://github.com/krenor>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
import env = 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 {
|
|
/**
|
|
* You can specify a custom path if your file containing environment variables is named or located differently.
|
|
* @default '.env'
|
|
*/
|
|
path?: string,
|
|
/**
|
|
* Path to example environment file. (Option 1)
|
|
* @default ".env.example"
|
|
*/
|
|
example?: string,
|
|
/**
|
|
* Path to example environment file. (Option 2 -- example takes precendence)
|
|
* @default ".env.example"
|
|
*/
|
|
sample?: string,
|
|
/**
|
|
* Path to environment file.
|
|
* @default ".env"
|
|
*/
|
|
silent?: boolean,
|
|
/**
|
|
* Encoding of your file containing environment variables.
|
|
* @default "utf8"
|
|
*/
|
|
encoding?: 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 load(options?: DotenvSafeOptions): env.DotenvConfigOutput
|
|
|
|
/**
|
|
* Loads environment variables file into 'process.env'.
|
|
*
|
|
* @throws MissingEnvVarsError
|
|
*/
|
|
export function config(options?: DotenvSafeOptions): env.DotenvConfigOutput
|