-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/// <reference types="dotenv" /> | ||
|
||
/** | ||
* The result of a call to load() or parse() | ||
*/ | ||
export interface IEnvironmentMap { | ||
[name: string]: string; | ||
} | ||
|
||
/** | ||
* DotenvExtended options for load(). | ||
*/ | ||
export interface IDotenvExtendedOptions { | ||
/** | ||
* Sets the encoding of the .env files. | ||
* | ||
* @default 'utf-8' | ||
*/ | ||
encoding?: string; | ||
|
||
/** | ||
* Sets whether a log message is shown when missing the .env or .env.defaults files. | ||
* | ||
* @default true | ||
*/ | ||
silent?: boolean; | ||
|
||
/** | ||
* Path to the main .env file that contains your variables. | ||
* | ||
* @default '.env' | ||
*/ | ||
path?: string; | ||
|
||
/** | ||
* The path to the file that default values are loaded from. | ||
* | ||
* @default '.env.defaults' | ||
*/ | ||
defaults?: string; | ||
|
||
/** | ||
* The path to the file that contains the schema of what values should be available | ||
* from combining .env and .env.defaults. | ||
* | ||
* @default '.env.schema' | ||
*/ | ||
schema?: string; | ||
|
||
/** | ||
* Causes the library to throw a MISSING CONFIG VALUES error listing all of the variables | ||
* missing the combined .env and .env.defaults files. | ||
* | ||
* @default false | ||
*/ | ||
errorOnMissing?: boolean; | ||
|
||
/** | ||
* Causes the library to throw a EXTRA CONFIG VALUES error listing all of the extra variables | ||
* from the combined .env and .env.defaults files. | ||
* | ||
* @default false | ||
*/ | ||
errorOnExtra?: boolean; | ||
|
||
/** | ||
* Sets whether the loaded values are assigned to the process.env object. | ||
* If this is set, you must capture the return value of the call to .load() or you will not be | ||
* able to use your variables. | ||
* | ||
* @default true | ||
*/ | ||
assignToProcessEnv?: boolean; | ||
|
||
/** | ||
* By defaut, dotenv-entended will not overwrite any varibles that are already set in the process.env object. | ||
* If you would like to enable overwriting any already existing values, set this value to true. | ||
* | ||
* @default false | ||
*/ | ||
overrideProcessEnv?: boolean; | ||
} | ||
|
||
export { parse } from 'dotenv'; | ||
|
||
/** | ||
* Loads the dotenv files, .env, .env.defaults and .env.schema. | ||
* | ||
* @param options | ||
*/ | ||
export function load(options?: IDotenvExtendedOptions): IEnvironmentMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
{ | ||
"name": "dotenv-extended", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A module for loading .env files and optionally loading defaults and a schema for validating all values are present.", | ||
"repository": "[email protected]:keithmorris/node-dotenv-extended.git", | ||
"main": "lib/index.js", | ||
"types": "dotenv-extended.d.ts", | ||
"bin": "lib/bin/index.js", | ||
"scripts": { | ||
"test": "gulp unittest", | ||
|
@@ -49,6 +50,7 @@ | |
] | ||
}, | ||
"dependencies": { | ||
"@types/dotenv": "^4.0.0", | ||
"auto-parse": "^1.3.0", | ||
"camelcase": "^4.1.0", | ||
"cross-spawn": "^5.1.0", | ||
|