Comparing version 1.1.0 to 1.2.0
@@ -21,6 +21,6 @@ # Contributing | ||
We use [eslint](http://eslint.org) and [editorconfig](http://editorconfig.org) to maintain code style and best practices. Please make sure your PR adheres to the guides by running: | ||
We use [standard](https://www.npmjs.com/package/standard) and [editorconfig](http://editorconfig.org) to maintain code style and best practices. Please make sure your PR adheres to the guides by running: | ||
``` | ||
gulp lint | ||
npm run lint | ||
``` |
@@ -17,2 +17,5 @@ 'use strict' | ||
if (options) { | ||
if (options.silent) { | ||
silent = options.silent | ||
} | ||
if (options.path) { | ||
@@ -24,5 +27,2 @@ path = options.path | ||
} | ||
if (options.silent) { | ||
silent = options.silent | ||
} | ||
} | ||
@@ -29,0 +29,0 @@ |
{ | ||
"name": "dotenv", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Loads environment variables from .env file", | ||
"main": "lib/main.js", | ||
"scripts": { | ||
"test": "lab test/* --coverage && standard" | ||
"test": "lab test/* --coverage && standard", | ||
"lint": "standard" | ||
}, | ||
@@ -24,5 +25,6 @@ "repository": { | ||
"author": "scottmotte", | ||
"license": "BSD", | ||
"license": "BSD-2-Clause", | ||
"devDependencies": { | ||
"lab": "^5.3.0", | ||
"semver": "^4.3.6", | ||
"should": "4.4.2", | ||
@@ -32,4 +34,3 @@ "sinon": "1.12.2", | ||
}, | ||
"dependencies": { | ||
} | ||
"dependencies": {} | ||
} |
@@ -7,15 +7,15 @@ # dotenv | ||
[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv) | ||
[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv) | ||
[![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) | ||
> "Storing [configuration in the environment](http://www.12factor.net/config) | ||
> is one of the tenets of a [twelve-factor app](http://www.12factor.net/). | ||
> Anything that is likely to change between deployment environments–such as | ||
> resource handles for databases or credentials for external services–should be | ||
> "Storing [configuration in the environment](http://www.12factor.net/config) | ||
> is one of the tenets of a [twelve-factor app](http://www.12factor.net/). | ||
> Anything that is likely to change between deployment environments–such as | ||
> resource handles for databases or credentials for external services–should be | ||
> extracted from the code into environment variables. | ||
> | ||
> But it is not always practical to set environment variables on development | ||
> machines or continuous integration servers where multiple projects are run. | ||
> Dotenv loads variables from a `.env` file into ENV when the environment is | ||
> But it is not always practical to set environment variables on development | ||
> machines or continuous integration servers where multiple projects are run. | ||
> Dotenv loads variables from a `.env` file into ENV when the environment is | ||
> bootstrapped." | ||
@@ -39,3 +39,3 @@ > | ||
Create a `.env` file in the root directory of your project. Add | ||
Create a `.env` file in the root directory of your project. Add | ||
environment-specific variables on new lines in the form of `NAME=VALUE`. | ||
@@ -62,5 +62,20 @@ For example: | ||
### Preload | ||
If you are using iojs-v1.6.0 or later, 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. | ||
```bash | ||
$ node -r dotenv/config your_script.js | ||
``` | ||
The configuration options below are supported as command line arguments in the format `dotenv_config_<option>=value` | ||
```bash | ||
$ node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars | ||
``` | ||
## Config | ||
`config` will read your .env file, parse the contents, and assign it to | ||
`config` will read your .env file, parse the contents, and assign it to | ||
`process.env` - just like `load` does. You can additionally, pass options to | ||
@@ -73,2 +88,13 @@ `config`. | ||
#### Silent | ||
Default: `false` | ||
Dotenv outputs a warning to your console if missing a `.env` file. Suppress | ||
this warning using silent. | ||
```js | ||
require('dotenv').config({silent: true}); | ||
``` | ||
#### Path | ||
@@ -78,3 +104,3 @@ | ||
You can specify a custom path if your file containing environment variables is | ||
You can specify a custom path if your file containing environment variables is | ||
named or located differently. | ||
@@ -90,3 +116,3 @@ | ||
You may specify the encoding of your file containing environment variables | ||
You may specify the encoding of your file containing environment variables | ||
using this option. | ||
@@ -100,4 +126,4 @@ | ||
The engine which parses the contents of your file containing environment | ||
variables is available to use. It accepts a String or Buffer and will return | ||
The engine which parses the contents of your file containing environment | ||
variables is available to use. It accepts a String or Buffer and will return | ||
an Object with the parsed keys and values. | ||
@@ -121,3 +147,3 @@ | ||
- single and double quoted values are escaped (`SINGLE_QUOTE='quoted'` becomes `{SINGLE_QUOTE: "quoted"}`) | ||
- new lines are expanded if in double quotes (`MULTILINE='new\nline'` becomes | ||
- new lines are expanded if in double quotes (`MULTILINE="new\nline"` becomes | ||
@@ -139,5 +165,5 @@ ``` | ||
Parsing that would result in `{BASIC: 'basic', TEST: 'basic'}`. You can escape | ||
variables by quoting or beginning with `\` (e.g. `TEST=\$BASIC`). If the | ||
variable is not found in the file, `process.env` is checked. Missing variables | ||
Parsing that would result in `{BASIC: 'basic', TEST: 'basic'}`. You can escape | ||
variables by quoting or beginning with `\` (e.g. `TEST=\$BASIC`). If the | ||
variable is not found in the file, `process.env` is checked. Missing variables | ||
result in an empty string. | ||
@@ -163,5 +189,5 @@ | ||
No. We **strongly** recommend against committing your .env file to version | ||
control. It should only include environment-specific values such as database | ||
passwords or API keys. Your production database should have a different | ||
No. We **strongly** recommend against committing your .env file to version | ||
control. It should only include environment-specific values such as database | ||
passwords or API keys. Your production database should have a different | ||
password than your development database. | ||
@@ -183,2 +209,1 @@ | ||
* [github-streaker](https://github.com/motdotla/github-streaker) | ||
@@ -198,3 +198,8 @@ 'use strict' | ||
}) | ||
it('retains spaces in string', function (done) { | ||
parsed.INCLUDE_SPACE.should.eql('some spaced out string') | ||
done() | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
22174
12
0
0
283
199
5
10
1