Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petrgrishin/nodedotenv
[deprecated] Loads environment variables from .env for your projects with nodejs support.
https://github.com/petrgrishin/nodedotenv
Last synced: 8 days ago
JSON representation
[deprecated] Loads environment variables from .env for your projects with nodejs support.
- Host: GitHub
- URL: https://github.com/petrgrishin/nodedotenv
- Owner: petrgrishin
- License: mit
- Created: 2015-03-30T08:41:53.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-30T08:43:02.000Z (almost 10 years ago)
- Last Synced: 2024-11-08T16:17:03.834Z (2 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nodedotenv
Loads environment variables from .env for your projects with nodejs support.## Install
```sh
npm install https://github.com/DsXack/nodedotenv --save
```## Use
include module:
```javascript
env = require('nodedotenv')
```async load:
```javascript
env.load('.env', callback)// or
env.load(callback)
```sync load:
```javascript
env.loadSync('.env')// or
env.loadSync()
````require` and `default` env variables and variable values
```javascript
env = require('nodedotenv')env.load(function () {
env.require('APP_ENV', ['dev', 'production'])
env.require('MYSQL_USERNAME')
env.require('MYSQL_PASSWORD')
env.require('MYSQL_DATABASE')
env.default('MYSQL_HOST', 'localhost')
env.default('MYSQL_PORT', '3306')
})
```## Test
coming soon
## Build
```sh
npm install
gulp
```