https://github.com/codhek/dashenv
npm package to load environment variables from a -env file
https://github.com/codhek/dashenv
environment-variables npm-package
Last synced: about 2 months ago
JSON representation
npm package to load environment variables from a -env file
- Host: GitHub
- URL: https://github.com/codhek/dashenv
- Owner: CodHeK
- Created: 2018-11-09T09:05:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-09T11:47:16.000Z (over 7 years ago)
- Last Synced: 2025-01-19T17:12:48.419Z (about 1 year ago)
- Topics: environment-variables, npm-package
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dashenv

```
npm i dashenv
```
### How to use ?
#
Save your environment variables in a file `-env`, pass your `path` to the `-env` file and also a `callback` function to get your environment variables.
#### Your `-env` file :
#
```
ENDPOINT=http://localhost:3000/graphql
SERVER=development
```
#### Use it as follows in the file you want to use your environment variables :
#
```
const extract = require('dashenv');
const path = './env_vars/-env';
extract(path, function(env) {
console.log(env["ENDPOINT"]);
console.log(env["SERVER"]);
});
```