Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions types/dotenv-safe/dotenv-safe-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ env.load({
path: "/foo/bar/baz.env",
sample: "/foo/bar/qux.env"
})

env.config({
allowEmptyValues: true,
path: "/foo/bar/baz.env",
sample: "/foo/bar/qux.env"
})
29 changes: 21 additions & 8 deletions types/dotenv-safe/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for dotenv-safe 4.0
// 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
Expand All @@ -18,12 +18,11 @@ export interface MissingEnvVarsError extends Error {
missing: string[]
}

/**
* Loads environment variables file into 'process.env'.
*
* @throws MissingEnvVarsError
*/
export function load(options?: {
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.
Expand All @@ -45,4 +44,18 @@ export function load(options?: {
* @default false
*/
allowEmptyValues?: boolean,
}): env.DotenvResult
}

/**
* Loads environment variables file into 'process.env'.
*
* @throws MissingEnvVarsError
*/
export function load(options?: DotenvSafeOptions): env.DotenvResult

/**
* Loads environment variables file into 'process.env'.
*
* @throws MissingEnvVarsError
*/
export function config(options?: DotenvSafeOptions): env.DotenvResult