@karmaniverous/get-dotenv 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -13,6 +13,14 @@ Load environment variables with a cascade of environment-aware dotenv files. You
|
|
|
13
13
|
|
|
14
14
|
The command-line version can pull the environment designator from a number of sources, populate `process.env`, and execute a shell command.
|
|
15
15
|
|
|
16
|
+
`getdotenv` relies on the excellent [`dotenv`](https://www.npmjs.com/package/dotenv) parser and uses [`dotenv-expand`](https://www.npmjs.com/package/dotenv-expand) for recursive variable expansion.
|
|
17
|
+
|
|
18
|
+
**So why not just use the very popular [`dotenv-cli`](https://www.npmjs.com/package/dotenv-cli) package to load dotenv file cascades?** A couple of reasons:
|
|
19
|
+
|
|
20
|
+
- `dotenv-cli` assumes all your `.env` files are located in your root directory. If you have a lot of environments, you probably want to sequester them into their own directory.
|
|
21
|
+
|
|
22
|
+
- The `dotenv-cli` syntax requires the environment to be set (the `-c` argument) _before_ the shell command is articulated (after the `--`). This doesn't work if you want to write an NPM script that takes the environment as an argument, since in that case it would have to go at the end.
|
|
23
|
+
|
|
16
24
|
## Installation
|
|
17
25
|
|
|
18
26
|
```bash
|
|
@@ -71,7 +79,7 @@ Options:
|
|
|
71
79
|
|
|
72
80
|
<dl>
|
|
73
81
|
<dt><a href="#getDotenv">getDotenv([options])</a> ⇒ <code>Object</code></dt>
|
|
74
|
-
<dd><p>Asynchronously process dotenv files of the form .env[.<ENV>][.<
|
|
82
|
+
<dd><p>Asynchronously process dotenv files of the form .env[.<ENV>][.<PRIVATE_TOKEN>]</p>
|
|
75
83
|
</dd>
|
|
76
84
|
<dt><a href="#getDotenvSync">getDotenvSync([options])</a> ⇒ <code>Object</code></dt>
|
|
77
85
|
<dd><p>Synchronously process dotenv files of the form .env[.<ENV>][.<PRIVATETOKEN>]</p>
|
|
@@ -89,7 +97,7 @@ Options:
|
|
|
89
97
|
<a name="getDotenv"></a>
|
|
90
98
|
|
|
91
99
|
## getDotenv([options]) ⇒ <code>Object</code>
|
|
92
|
-
Asynchronously process dotenv files of the form .env[.<ENV>][.<
|
|
100
|
+
Asynchronously process dotenv files of the form .env[.<ENV>][.<PRIVATE_TOKEN>]
|
|
93
101
|
|
|
94
102
|
**Kind**: global function
|
|
95
103
|
**Returns**: <code>Object</code> - The combined parsed dotenv object.
|
|
@@ -126,7 +134,7 @@ get-dotenv options type
|
|
|
126
134
|
| [excludePublic] | <code>bool</code> | exclude public variables (default: false) |
|
|
127
135
|
| [loadProcess] | <code>bool</code> | load dotenv to process.env (default: false) |
|
|
128
136
|
| [log] | <code>bool</code> | log result to console (default: false) |
|
|
129
|
-
| [path] | <code>string</code> | path to target directory |
|
|
137
|
+
| [path] | <code>string</code> | path to target directory (default './') |
|
|
130
138
|
| [privateToken] | <code>string</code> | token indicating private variables (default: 'local'). |
|
|
131
139
|
|
|
132
140
|
|
|
@@ -19,12 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
* @property {bool} [excludePublic] - exclude public variables (default: false)
|
|
20
20
|
* @property {bool} [loadProcess] - load dotenv to process.env (default: false)
|
|
21
21
|
* @property {bool} [log] - log result to console (default: false)
|
|
22
|
-
* @property {string} [path] - path to target directory
|
|
22
|
+
* @property {string} [path] - path to target directory (default './')
|
|
23
23
|
* @property {string} [privateToken] - token indicating private variables (default: 'local').
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Asynchronously process dotenv files of the form .env[.<ENV>][.<
|
|
27
|
+
* Asynchronously process dotenv files of the form .env[.<ENV>][.<PRIVATE_TOKEN>]
|
|
28
28
|
*
|
|
29
29
|
* @async
|
|
30
30
|
* @function getDotenv
|
|
@@ -13,12 +13,12 @@ import { readDotenv, readDotenvSync } from '../readDotEnv/readDotenv.js';
|
|
|
13
13
|
* @property {bool} [excludePublic] - exclude public variables (default: false)
|
|
14
14
|
* @property {bool} [loadProcess] - load dotenv to process.env (default: false)
|
|
15
15
|
* @property {bool} [log] - log result to console (default: false)
|
|
16
|
-
* @property {string} [path] - path to target directory
|
|
16
|
+
* @property {string} [path] - path to target directory (default './')
|
|
17
17
|
* @property {string} [privateToken] - token indicating private variables (default: 'local').
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Asynchronously process dotenv files of the form .env[.<ENV>][.<
|
|
21
|
+
* Asynchronously process dotenv files of the form .env[.<ENV>][.<PRIVATE_TOKEN>]
|
|
22
22
|
*
|
|
23
23
|
* @async
|
|
24
24
|
* @function getDotenv
|