dashenv
Version:
Set your env variables, client/server side.
30 lines (24 loc) • 624 B
Markdown
# @codhek/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"]);
});
```