dotenv
Advanced tools
Comparing version 16.3.1 to 16.3.2
@@ -7,2 +7,13 @@ # Changelog | ||
## [16.3.2](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2) (2024-01-18) | ||
### Added | ||
- Add debug message when no encoding set [#735](https://github.com/motdotla/dotenv/pull/735) | ||
### Changed | ||
- Fix output typing for `populate` [#792](https://github.com/motdotla/dotenv/pull/792) | ||
- Use subarray instead of slice [#793](https://github.com/motdotla/dotenv/pull/793) | ||
## [16.3.1](https://github.com/motdotla/dotenv/compare/v16.3.0...v16.3.1) (2023-06-17) | ||
@@ -9,0 +20,0 @@ |
@@ -15,3 +15,2 @@ // TypeScript Version: 3.0 | ||
* @param src - contents to be parsed. example: `'DB_HOST=localhost'` | ||
* @param options - additional options. example: `{ debug: true }` | ||
* @returns an object with keys and values based on `src`. example: `{ DB_HOST : 'localhost' }` | ||
@@ -104,6 +103,2 @@ */ | ||
export interface DotenvPopulateOutput { | ||
error?: Error; | ||
} | ||
export interface DotenvPopulateInput { | ||
@@ -146,3 +141,3 @@ [name: string]: string; | ||
*/ | ||
export function populate(processEnv: DotenvPopulateInput, parsed: DotenvPopulateInput, options?: DotenvConfigOptions): DotenvPopulateOutput; | ||
export function populate(processEnv: DotenvPopulateInput, parsed: DotenvPopulateInput, options?: DotenvConfigOptions): void; | ||
@@ -149,0 +144,0 @@ /** |
@@ -193,2 +193,6 @@ const fs = require('fs') | ||
encoding = options.encoding | ||
} else { | ||
if (debug) { | ||
_debug('No encoding is specified. UTF-8 is used by default') | ||
} | ||
} | ||
@@ -241,5 +245,5 @@ } | ||
const nonce = ciphertext.slice(0, 12) | ||
const authTag = ciphertext.slice(-16) | ||
ciphertext = ciphertext.slice(12, -16) | ||
const nonce = ciphertext.subarray(0, 12) | ||
const authTag = ciphertext.subarray(-16) | ||
ciphertext = ciphertext.subarray(12, -16) | ||
@@ -246,0 +250,0 @@ try { |
{ | ||
"name": "dotenv", | ||
"version": "16.3.1", | ||
"version": "16.3.2", | ||
"description": "Loads environment variables from .env file", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
102
README.md
@@ -21,19 +21,19 @@ <div align="center"> | ||
<br> | ||
<a href="https://retool.com/?utm_source=sponsor&utm_campaign=dotenv"> | ||
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=dotenv&utm_source=github"> | ||
<div> | ||
<img src="https://res.cloudinary.com/dotenv-org/image/upload/c_scale,w_300/v1664466968/logo-full-black_vidfqf.png" width="270" alt="Retool"> | ||
<img src="https://res.cloudinary.com/dotenv-org/image/upload/c_scale,w_400/v1665605496/68747470733a2f2f73696e647265736f726875732e636f6d2f6173736574732f7468616e6b732f776f726b6f732d6c6f676f2d77686974652d62672e737667_zdmsbu.svg" width="270" alt="WorkOS"> | ||
</div> | ||
<b>Retool helps developers build custom internal software, like CRUD apps and admin panels, really fast.</b> | ||
<b>Your App, Enterprise Ready.</b> | ||
<div> | ||
<sup>Build UIs visually with flexible components, connect to any data source, and write business logic in JavaScript.</sup> | ||
<sup>Add Single Sign-On, Multi-Factor Auth, and more, in minutes instead of months.</sup> | ||
</div> | ||
</a> | ||
<br> | ||
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=dotenv&utm_source=github"> | ||
<br/> | ||
<a href="https://runalloy.com/?utm_source=github&utm_medium=referral&utm_campaign=1224_dotenv"> | ||
<div> | ||
<img src="https://res.cloudinary.com/dotenv-org/image/upload/c_scale,w_400/v1665605496/68747470733a2f2f73696e647265736f726875732e636f6d2f6173736574732f7468616e6b732f776f726b6f732d6c6f676f2d77686974652d62672e737667_zdmsbu.svg" width="270" alt="WorkOS"> | ||
<img src="https://res.cloudinary.com/dotenv-org/image/upload/c_crop,g_center,h_65,w_290,x_0,y_0/v1704258787/AlloyAutomation-logo_dqin8c.svg" width="370" alt="Alloy Automation"> | ||
</div> | ||
<b>Your App, Enterprise Ready.</b> | ||
<b>Launch user-facing integrations faster</b> | ||
<div> | ||
<sup>Add Single Sign-On, Multi-Factor Auth, and more, in minutes instead of months.</sup> | ||
<sup>Easily spin up hundreds of integrations. Sign up free or read our docs first</sup> | ||
</div> | ||
@@ -48,3 +48,3 @@ </a> | ||
Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology. | ||
Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](https://12factor.net/config) methodology. | ||
@@ -57,4 +57,4 @@ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) | ||
* [ποΈ Usage (.env)](#%EF%B8%8F-usage) | ||
* [π΄ Multiple Environments π](#-manage-multiple-environments) | ||
* [π Deploying (.env.vault) π](#-deploying) | ||
* [π΄ Multiple Environments π](#-manage-multiple-environments) | ||
* [π Examples](#-examples) | ||
@@ -186,10 +186,28 @@ * [π Docs](#-documentation) | ||
### Multiple Environments | ||
You need to manage your secrets across different environments and apply them as needed? Use a `.env.vault` file with a `DOTENV_KEY`. | ||
### Deploying | ||
You need to deploy your secrets in a cloud-agnostic manner? Use a `.env.vault` file. | ||
You need to deploy your secrets in a cloud-agnostic manner? Use a `.env.vault` file. See [deploying `.env.vault` files](https://github.com/motdotla/dotenv/tree/master#-deploying). | ||
### Multiple Environments | ||
## π΄ Manage Multiple Environments | ||
You need to manage your secrets across different environments and apply them as needed? Use a `.env.vault` file with a `DOTENV_KEY`. | ||
Edit your production environment variables. | ||
```bash | ||
$ npx dotenv-vault open production | ||
``` | ||
Regenerate your `.env.vault` file. | ||
```bash | ||
$ npx dotenv-vault build | ||
``` | ||
*βΉοΈ π Vault Managed vs π» Locally Managed: The above example, for brevity's sake, used the π Vault Managed solution to manage your `.env.vault` file. You can instead use the π» Locally Managed solution. [Read more here](https://github.com/dotenv-org/dotenv-vault#how-do-i-use--locally-managed-dotenv-vault). Our vision is that other platforms and orchestration tools adopt the `.env.vault` standard as they did the `.env` standard. We don't expect to be the only ones providing tooling to manage and generate `.env.vault` files.* | ||
<a href="https://github.com/dotenv-org/dotenv-vault#-manage-multiple-environments">Learn more at dotenv-vault: Manage Multiple Environments</a> | ||
## π Deploying | ||
@@ -222,22 +240,4 @@ | ||
<a href="https://github.com/dotenv-org/dotenv-vault#dotenv-vault-">Learn more at dotenv-vault: Deploying</a> | ||
<a href="https://github.com/dotenv-org/dotenv-vault#-deploying">Learn more at dotenv-vault: Deploying</a> | ||
## π΄ Manage Multiple Environments | ||
Edit your production environment variables. | ||
```bash | ||
$ npx dotenv-vault open production | ||
``` | ||
Regenerate your `.env.vault` file. | ||
```bash | ||
$ npx dotenv-vault build | ||
``` | ||
*βΉοΈ π Vault Managed vs π» Locally Managed: The above example, for brevity's sake, used the π Vault Managed solution to manage your `.env.vault` file. You can instead use the π» Locally Managed solution. [Read more here](https://github.com/dotenv-org/dotenv-vault#how-do-i-use--locally-managed-dotenv-vault). Our vision is that other platforms and orchestration tools adopt the `.env.vault` standard as they did the `.env` standard. We don't expect to be the only ones providing tooling to manage and generate `.env.vault` files.* | ||
<a href="https://github.com/dotenv-org/dotenv-vault#-manage-multiple-environments">Learn more at dotenv-vault: Manage Multiple Environments</a> | ||
## π Examples | ||
@@ -247,19 +247,19 @@ | ||
* [nodejs](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs) | ||
* [nodejs (debug on)](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs-debug) | ||
* [nodejs (override on)](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs-override) | ||
* [nodejs (processEnv override)](https://github.com/dotenv-org/examples/tree/master/dotenv-custom-target) | ||
* [nodejs (DOTENV_KEY override)](https://github.com/dotenv-org/examples/tree/master/dotenv-vault-custom-target) | ||
* [esm](https://github.com/dotenv-org/examples/tree/master/dotenv-esm) | ||
* [esm (preload)](https://github.com/dotenv-org/examples/tree/master/dotenv-esm-preload) | ||
* [typescript](https://github.com/dotenv-org/examples/tree/master/dotenv-typescript) | ||
* [typescript parse](https://github.com/dotenv-org/examples/tree/master/dotenv-typescript-parse) | ||
* [typescript config](https://github.com/dotenv-org/examples/tree/master/dotenv-typescript-config) | ||
* [webpack](https://github.com/dotenv-org/examples/tree/master/dotenv-webpack) | ||
* [webpack (plugin)](https://github.com/dotenv-org/examples/tree/master/dotenv-webpack2) | ||
* [react](https://github.com/dotenv-org/examples/tree/master/dotenv-react) | ||
* [react (typescript)](https://github.com/dotenv-org/examples/tree/master/dotenv-react-typescript) | ||
* [express](https://github.com/dotenv-org/examples/tree/master/dotenv-express) | ||
* [nestjs](https://github.com/dotenv-org/examples/tree/master/dotenv-nestjs) | ||
* [fastify](https://github.com/dotenv-org/examples/tree/master/dotenv-fastify) | ||
* [nodejs](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nodejs) | ||
* [nodejs (debug on)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nodejs-debug) | ||
* [nodejs (override on)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nodejs-override) | ||
* [nodejs (processEnv override)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-custom-target) | ||
* [nodejs (DOTENV_KEY override)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-vault-custom-target) | ||
* [esm](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-esm) | ||
* [esm (preload)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-esm-preload) | ||
* [typescript](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-typescript) | ||
* [typescript parse](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-typescript-parse) | ||
* [typescript config](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-typescript-config) | ||
* [webpack](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-webpack) | ||
* [webpack (plugin)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-webpack2) | ||
* [react](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-react) | ||
* [react (typescript)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-react-typescript) | ||
* [express](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-express) | ||
* [nestjs](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nestjs) | ||
* [fastify](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-fastify) | ||
@@ -570,3 +570,3 @@ ## π Documentation | ||
Does that make sense? It's a bit unintuitive, but it is how importing of ES6 modules work. Here is a [working example of this pitfall](https://github.com/dotenv-org/examples/tree/master/dotenv-es6-import-pitfall). | ||
Does that make sense? It's a bit unintuitive, but it is how importing of ES6 modules work. Here is a [working example of this pitfall](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-es6-import-pitfall). | ||
@@ -573,0 +573,0 @@ There are two alternatives to this approach: |
72078