https://github.com/srph/dotenv-autoload
:eyes: Autoload dotenv through recursive finding
https://github.com/srph/dotenv-autoload
Last synced: 3 months ago
JSON representation
:eyes: Autoload dotenv through recursive finding
- Host: GitHub
- URL: https://github.com/srph/dotenv-autoload
- Owner: srph
- Created: 2016-01-20T02:37:46.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-21T20:29:12.000Z (over 10 years ago)
- Last Synced: 2025-03-21T22:42:42.890Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## dotenv-autoload [](https://npmjs.org/package/dotenv-autoload?style=flat-square) [](https://travis-ci.org/srph/dotenv-autoload?branch=master)
Autoload [`dotenv`](https://github.com/motdotla/dotenv/) through recursive finding.
## Why?
With and without dotenv-autoload:
```diff
- require('dotenv').load({ path: __dirname + '/../../.env' });
+ require('dotenv-autoload');
```
Nothing is bad about it. It just looks dull.
This is only useful when running modules not located in the same directory as the `.env` file.
## Getting Started
```
npm i dotenv dotenv-autoload --save-dev
```
**Note**: `dotenv` **is** a **required** dependency.
## Usage
```js
require('dotenv-autoload');
```
That's all you need to get it running.