Skip to content

Commit

Permalink
style(readme): correct lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed May 18, 2021
1 parent f41a879 commit 2ce0ca1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ automatically load dotenv files based on `NODE_ENV`
[![test][test-img]][test-url]
[![semantic][semantic-img]][semantic-url]

<img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png" alt="dotenv" align="right" />

> `autoenv` uses [`dotenv`][] to **automatically** load environment variables from a [compatible][] `.env` file into [`process.env`][].
`autoenv` uses [`dotenv`][] to **automatically** load environment variables from a [compatible][] `.env` file into [`process.env`][].

## Install

Expand All @@ -22,27 +20,29 @@ npm install --only=production --save autoenv

Create a default `.env` file in the root directory of your project.

``` dosini
``` ini
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
```

Create additional `.env.xyz` files matching as many environment variants you want:

my_project/
├── .env
├── .env.development
├── .env.staging
└── .env.production
``` plain
my_project/
├── .env
├── .env.development
├── .env.staging
└── .env.production
```

The **default** `.env` will always be loaded, if a matching `.env.${NODE_ENV}` file is present, it will be loaded and overrides the values in `.env`

## Usage

As early as possible in your application, require and configure dotenv.

``` javascript
``` js
require('autoenv')
```

Expand All @@ -69,7 +69,7 @@ That's it.

`process.env` now has the keys and values you defined in your `.env` file.

``` javascript
``` js
const db = require('db')
db.connect({
host: process.env.DB_HOST,
Expand Down
14 changes: 5 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

<img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png" alt="dotenv" align="right" />

> `autoenv` uses [`dotenv`][dotenv] to **automatically** load environment variables from a [compatible](#config) `.env` file into [`process.env`][process-env].
`autoenv` uses [`dotenv`][dotenv] to **automatically** load environment variables from a [compatible](#config) `.env` file into [`process.env`][process-env].

## Install

Expand All @@ -13,15 +10,15 @@ npm install --only=production --save autoenv

Create a default `.env` file in the root directory of your project.

```dosini
```ini
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
```

Create additional `.env.xyz` files matching as many environment variants you want:

```
```plain
my_project/
├── .env
├── .env.development
Expand All @@ -35,7 +32,7 @@ The **default** `.env` will always be loaded, if a matching `.env.${NODE_ENV}` f

As early as possible in your application, require and configure dotenv.

```javascript
```js
require('autoenv')
```

Expand All @@ -54,7 +51,6 @@ $ node index.js

You can use the `--require` (`-r`) command line option to preload autoenv. By doing this, you do not need to `require` in your application code.


```bash
$ node -r autoenv index.js
```
Expand All @@ -63,7 +59,7 @@ That's it.

`process.env` now has the keys and values you defined in your `.env` file.

```javascript
```js
const db = require('db')
db.connect({
host: process.env.DB_HOST,
Expand Down

0 comments on commit 2ce0ca1

Please sign in to comment.