@dotenvx/dotenvx 0.6.1 → 0.6.2

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
@@ -2,9 +2,9 @@
2
2
 
3
3
  *a better dotenv*–from the creator of [`dotenv`](https://github.com/motdotla/dotenv).
4
4
 
5
- * run anywhere (cross-platform)
6
- * multi-environment
7
- * encrypted envs
5
+ * [run anywhere](#run-anywhere) (cross-platform)
6
+ * [multi-environment](#multiple-environments)
7
+ * [encrypted envs](#encrypt-your-env-files)
8
8
 
9
9
   
10
10
 
@@ -190,30 +190,109 @@ More examples
190
190
 
191
191
  ## Multiple Environments
192
192
 
193
- Pass the `--env-file` flag (shorthand `-f`) to run any environment from a `.env.environment` file.
194
-
193
+ > Create a `.env.production` file and use `--env-file` to load it. It's straightforward, yet flexible.
195
194
  ```sh
195
+ $ echo "HELLO=production" > .env.production
196
+
196
197
  $ dotenvx run --env-file=.env.production -- node index.js
197
- [dotenvx][INFO] injecting 12 environment variables from .env.production
198
+ Hello production
199
+ > ^^
198
200
  ```
199
201
 
200
- Combine multiple `.env` files if you like.
202
+ More examples
201
203
 
202
- ```
203
- $ dotenvx run --env-file=.env.local --env-file=.env -- node index.js
204
- [dotenvx][INFO] injecting 13 environment variables from .env.local,.env
205
- ```
204
+ * <details><summary>multiple `.env` files</summary><br>
205
+
206
+ ```sh
207
+ $ echo "HELLO=local" > .env.local
208
+
209
+ $ echo "HELLO=World" > .env
210
+
211
+ $ dotenvx run --env-file=.env.local --env-file=.env -- node index.js
212
+ Hello local
213
+ ```
214
+
215
+ </details>
216
+
217
+ * <details><summary>`--overload` flag</summary><br>
218
+
219
+ ```sh
220
+ $ echo "HELLO=local" > .env.local
221
+
222
+ $ echo "HELLO=World" > .env
223
+
224
+ $ dotenvx run --env-file=.env.local --env-file=.env --overload -- node index.js
225
+ Hello World
226
+ ```
227
+
228
+ * <details><summary>`--verbose` flag</summary><br>
229
+
230
+ ```sh
231
+ $ echo "HELLO=production" > .env.production
232
+
233
+ $ dotenvx run --env-file=.env.production --verbose -- node index.js
234
+ [dotenvx][VERBOSE] injecting env from /path/to/.env.production
235
+ [dotenvx][VERBOSE] HELLO set
236
+ [dotenvx][INFO] injecting 1 environment variable from .env.production
237
+ Hello production
238
+ ```
239
+
240
+ * <details><summary>`--debug` flag</summary><br>
241
+
242
+ ```sh
243
+ $ echo "HELLO=production" > .env.production
244
+
245
+ $ dotenvx run --env-file=.env.production --debug -- node index.js
246
+ [dotenvx][DEBUG] configuring options
247
+ [dotenvx][DEBUG] {"envFile":[".env.production"]}
248
+ [dotenvx][VERBOSE] injecting env from /path/to/.env.production
249
+ [dotenvx][DEBUG] reading env from /path/to/.env.production
250
+ [dotenvx][DEBUG] parsing env from /path/to/.env.production
251
+ [dotenvx][DEBUG] {"HELLO":"production"}
252
+ [dotenvx][DEBUG] writing env from /path/to/.env.production
253
+ [dotenvx][VERBOSE] HELLO set
254
+ [dotenvx][DEBUG] HELLO set to production
255
+ [dotenvx][INFO] injecting 1 environment variable from .env.production
256
+ Hello production
257
+ ```
258
+
259
+ </details>
206
260
 
207
261
  &nbsp;
208
262
 
209
263
  ## Encrypt Your Env Files
210
264
 
265
+ > Encrypt your secrets to a `.env.vault` file.
211
266
  ```
267
+ $ echo "HELLO=World" > .env
268
+
269
+ $ echo "HELLO=production" > .env.production
270
+
212
271
  $ dotenvx encrypt
213
- ```
272
+ [dotenvx][INFO] encrypted .env,.env.production to .env.vault
273
+ [dotenvx][INFO]
274
+ [dotenvx][INFO] try it out:
275
+ [dotenvx][INFO]
276
+ [dotenvx][INFO] DOTENV_KEY='<DOTENV_KEY_ENVIRONMENT>' dotenvx run -- node index.js
277
+ [dotenvx][INFO]
278
+ [dotenvx][INFO] next:
279
+ [dotenvx][INFO]
280
+ [dotenvx][INFO] 1. commit .env.vault safely to code
281
+ [dotenvx][INFO] 2. set DOTENV_KEY on server (or ci)
282
+ [dotenvx][INFO] 3. push your code
283
+ [dotenvx][INFO]
284
+ [dotenvx][INFO] tips:
285
+ [dotenvx][INFO]
286
+ [dotenvx][INFO] * .env.keys file holds your decryption DOTENV_KEYs
287
+ [dotenvx][INFO] * DO NOT commit .env.keys to code
288
+ [dotenvx][INFO] * share .env.keys file over secure channels only
289
+
290
+ $ DOTENV_KEY='dotenv://:key_abc123@dotenvx.com/vault/.env.vault?environment=development' dotenvx run -- node index.js
291
+ [dotenvx][INFO] injecting 1 environment variable from encrypted .env.vault
292
+ Hello World
214
293
 
215
- > This will encrypt your `.env` file to a `.env.vault` file. Commit your `.env.vault` file safely to code.
216
- > This will also generate a `.env.keys` file. Do NOT commit this file to code. Keep your `.env.keys` secret. 🤫
294
+ > :-]
295
+ ```
217
296
 
218
297
  &nbsp;
219
298
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.1",
2
+ "version": "0.6.2",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -270,6 +270,22 @@ program.command('encrypt')
270
270
  }
271
271
 
272
272
  logger.info(`encrypted ${optionEnvFile} to .env.vault`)
273
+ logger.info('')
274
+ logger.info('try it out:')
275
+ logger.info('')
276
+ logger.info(' DOTENV_KEY=\'<DOTENV_KEY_ENVIRONMENT>\' dotenvx run -- node index.js')
277
+ logger.info('')
278
+ logger.info('next:')
279
+ logger.info('')
280
+ logger.info(' 1. commit .env.vault safely to code')
281
+ logger.info(' 2. set DOTENV_KEY on server (or ci)')
282
+ logger.info(' 3. push your code')
283
+ logger.info('')
284
+ logger.info('tips:')
285
+ logger.info('')
286
+ logger.info(' * .env.keys file holds your decryption DOTENV_KEYs')
287
+ logger.info(' * DO NOT commit .env.keys to code')
288
+ logger.info(' * share .env.keys file over secure channels only')
273
289
  })
274
290
 
275
291
  program.parse(process.argv)