Skip to content

Commit

Permalink
Merge branch 'release/2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
keithmorris committed May 30, 2017
2 parents 35ae48c + 62af06b commit b9a7cc1
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.0.1 - 2017.05.30
- Add TypeScript definitions (thanks @toverux)

## 2.0.0 - 2017.04.26
- Add binary for injecting .env variables into non-node scripts

## 1.0.4 - 2016.10.23
- Replace `winston` library with generic `console` (Thanks @bostrom)

Expand Down
91 changes: 91 additions & 0 deletions dotenv-extended.d.ts
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;
4 changes: 3 additions & 1 deletion package.json
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",
Expand Down Expand Up @@ -49,6 +50,7 @@
]
},
"dependencies": {
"@types/dotenv": "^4.0.0",
"auto-parse": "^1.3.0",
"camelcase": "^4.1.0",
"cross-spawn": "^5.1.0",
Expand Down

0 comments on commit b9a7cc1

Please sign in to comment.