Skip to content

Commit b9a7cc1

Browse files
committed
Merge branch 'release/2.0.1'
2 parents 35ae48c + 62af06b commit b9a7cc1

File tree

3 files changed

+100
-1
lines changed

3 files changed

+100
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.0.1 - 2017.05.30
4+
- Add TypeScript definitions (thanks @toverux)
5+
6+
## 2.0.0 - 2017.04.26
7+
- Add binary for injecting .env variables into non-node scripts
8+
39
## 1.0.4 - 2016.10.23
410
- Replace `winston` library with generic `console` (Thanks @bostrom)
511

dotenv-extended.d.ts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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;

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "dotenv-extended",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "A module for loading .env files and optionally loading defaults and a schema for validating all values are present.",
55
"repository": "[email protected]:keithmorris/node-dotenv-extended.git",
66
"main": "lib/index.js",
7+
"types": "dotenv-extended.d.ts",
78
"bin": "lib/bin/index.js",
89
"scripts": {
910
"test": "gulp unittest",
@@ -49,6 +50,7 @@
4950
]
5051
},
5152
"dependencies": {
53+
"@types/dotenv": "^4.0.0",
5254
"auto-parse": "^1.3.0",
5355
"camelcase": "^4.1.0",
5456
"cross-spawn": "^5.1.0",

0 commit comments

Comments
 (0)