Comparing version 6.1.0 to 6.2.0-0
@@ -7,2 +7,8 @@ # Change Log | ||
## [6.2.0] - 2018-12-03 | ||
### Added | ||
- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351)) | ||
## [6.1.0] - 2018-10-08 | ||
@@ -36,3 +42,3 @@ | ||
- Testing aginst Node v7 | ||
- Testing against Node v7 | ||
@@ -103,3 +109,4 @@ | ||
[Unreleased]: https://github.com/motdotla/dotenv/compare/v6.1.0...HEAD | ||
[Unreleased]: https://github.com/motdotla/dotenv/compare/v6.2.0...HEAD | ||
[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0 | ||
[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0 | ||
@@ -106,0 +113,0 @@ [6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0 |
@@ -5,4 +5,8 @@ /* @flow */ | ||
require('./lib/main').config( | ||
require('./lib/cli-options')(process.argv) | ||
Object.assign( | ||
{}, | ||
require('./lib/env-options'), | ||
require('./lib/cli-options')(process.argv) | ||
) | ||
) | ||
})() |
{ | ||
"name": "dotenv", | ||
"version": "6.1.0", | ||
"version": "6.2.0-0", | ||
"description": "Loads environment variables from .env file", | ||
@@ -8,7 +8,6 @@ "main": "lib/main.js", | ||
"flow": "flow", | ||
"lint": "standard", | ||
"postlint": "standard-markdown", | ||
"pretest": "npm run lint", | ||
"test": "tap tests/*.js --100", | ||
"lint": "standard", | ||
"postlint": "npm run lint-md", | ||
"lint-md": "standard-markdown" | ||
"test": "tap tests/*.js --100" | ||
}, | ||
@@ -31,3 +30,4 @@ "repository": { | ||
"devDependencies": { | ||
"flow-bin": "^0.82.0", | ||
"decache": "^4.5.0", | ||
"flow-bin": "^0.84.0", | ||
"sinon": "^6.3.5", | ||
@@ -34,0 +34,0 @@ "standard": "^12.0.1", |
@@ -8,3 +8,3 @@ # dotenv | ||
[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/rnba2pyi87hgc8xw/branch/master?svg=true)](https://ci.appveyor.com/project/maxbeatty/dotenv/branch/master) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/github/motdotla/dotenv?svg=true)](https://ci.appveyor.com/project/motdotla/dotenv/branch/master) | ||
[![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) | ||
@@ -57,3 +57,3 @@ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) | ||
You can use the `--require` (`-r`) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. This is the preferred approach when using `import` instead of `require`. | ||
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. This is the preferred approach when using `import` instead of `require`. | ||
@@ -70,2 +70,12 @@ ```bash | ||
Additionally, you can use environment variables to set configuration options. Command line arguments will precede these. | ||
```bash | ||
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv/config your_script.js | ||
``` | ||
```bash | ||
$ DOTENV_CONFIG_ENCODING=base64 node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env | ||
``` | ||
## Config | ||
@@ -97,4 +107,3 @@ | ||
You may specify a custom path if your file containing environment variables is | ||
named or located differently. | ||
You may specify a custom path if your file containing environment variables is located elsewhere. | ||
@@ -109,4 +118,3 @@ ```js | ||
You may specify the encoding of your file containing environment variables | ||
using this option. | ||
You may specify the encoding of your file containing environment variables. | ||
@@ -171,2 +179,3 @@ ```js | ||
``` | ||
- inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes `{JSON:"{\"foo\": \"bar\"}"`) | ||
@@ -202,3 +211,3 @@ - whitespace is removed from both ends of the value (see more on [`trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)) (`FOO=" some value "` becomes `{FOO: 'some value'}`) | ||
const envConfig = dotenv.parse(fs.readFileSync('.env.override')) | ||
for (var k in envConfig) { | ||
for (let k in envConfig) { | ||
process.env[k] = envConfig[k] | ||
@@ -215,4 +224,4 @@ } | ||
```js | ||
var dotenv = require('dotenv') | ||
var variableExpansion = require('dotenv-expand') | ||
const dotenv = require('dotenv') | ||
const variableExpansion = require('dotenv-expand') | ||
const myEnv = dotenv.config() | ||
@@ -224,6 +233,4 @@ variableExpansion(myEnv) | ||
For `dotenv@2.x.x`: Use [dotenv-expand](https://github.com/motdotla/dotenv-expand). | ||
Try [dotenv-expand](https://github.com/motdotla/dotenv-expand) | ||
For `dotenv@1.x.x`: We haven't been presented with a compelling use case for expanding variables and believe it leads to env vars that are not "fully orthogonal" as [The Twelve-Factor App](http://12factor.net/config) outlines.<sup>[[1](https://github.com/motdotla/dotenv/issues/39)][[2](https://github.com/motdotla/dotenv/pull/97)]</sup> Please open an issue if you have a compelling use case. | ||
### How do I use dotenv with `import`? | ||
@@ -230,0 +237,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
296
19570
6
8
117
2