This commit is contained in:
Lukian 2023-06-20 15:28:07 +02:00
parent 68f4b60012
commit 41ae7ff4bd
1010 changed files with 38622 additions and 17071 deletions

59
node_modules/dotenv/README.md generated vendored
View file

@ -242,6 +242,8 @@ See [examples](https://github.com/dotenv-org/examples) of using dotenv with vari
* [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)
@ -257,11 +259,12 @@ See [examples](https://github.com/dotenv-org/examples) of using dotenv with vari
## 📖 Documentation
Dotenv exposes three functions:
Dotenv exposes four functions:
* `config`
* `parse`
* `populate`
* `decrypt`
### Config
@ -283,7 +286,7 @@ You can additionally, pass options to `config`.
#### Options
##### Path
##### path
Default: `path.resolve(process.cwd(), '.env')`
@ -293,7 +296,7 @@ Specify a custom path if your file containing environment variables is located e
require('dotenv').config({ path: '/custom/path/to/.env' })
```
##### Encoding
##### encoding
Default: `utf8`
@ -303,7 +306,7 @@ Specify the encoding of your file containing environment variables.
require('dotenv').config({ encoding: 'latin1' })
```
##### Debug
##### debug
Default: `false`
@ -313,7 +316,7 @@ Turn on logging to help debug why certain keys or values are not being set as yo
require('dotenv').config({ debug: process.env.DEBUG })
```
##### Override
##### override
Default: `false`
@ -323,6 +326,30 @@ Override any environment variables that have already been set on your machine wi
require('dotenv').config({ override: true })
```
##### processEnv
Default: `process.env`
Specify an object to write your secrets to. Defaults to `process.env` environment variables.
```js
const myObject = {}
require('dotenv').config({ processEnv: myObject })
console.log(myObject) // values from .env or .env.vault live here now.
console.log(process.env) // this was not changed or written to
```
##### DOTENV_KEY
Default: `process.env.DOTENV_KEY`
Pass the `DOTENV_KEY` directly to config options. Defaults to looking for `process.env.DOTENV_KEY` environment variable. Note this only applies to decrypting `.env.vault` files. If passed as null or undefined, or not passed at all, dotenv falls back to its traditional job of parsing a `.env` file.
```js
require('dotenv').config({ DOTENV_KEY: 'dotenv://:key_1234…@dotenv.org/vault/.env.vault?environment=production' })
```
### Parse
The engine which parses the contents of your file containing environment
@ -338,7 +365,7 @@ console.log(typeof config, config) // object { BASIC : 'basic' }
#### Options
##### Debug
##### debug
Default: `false`
@ -379,7 +406,7 @@ dotenv.populate(target, parsed, { override: true, debug: true })
console.log(target) // { HELLO: 'universe' }
```
#### Options
#### options
##### Debug
@ -387,12 +414,28 @@ Default: `false`
Turn on logging to help debug why certain keys or values are not being populated as you expect.
##### Override
##### override
Default: `false`
Override any environment variables that have already been set.
### Decrypt
The engine which decrypts the ciphertext contents of your .env.vault file is available for use. It accepts a ciphertext and a decryption key. It uses AES-256-GCM encryption.
For example, decrypting a simple ciphertext:
```js
const dotenv = require('dotenv')
const ciphertext = 's7NYXa809k/bVSPwIAmJhPJmEGTtU0hG58hOZy7I0ix6y5HP8LsHBsZCYC/gw5DDFy5DgOcyd18R'
const decryptionKey = 'ddcaa26504cd70a6fef9801901c3981538563a1767c297cb8416e8a38c62fe00'
const decrypted = dotenv.decrypt(ciphertext, decryptionKey)
console.log(decrypted) // # development@v6\nALPHA="zeta"
```
## ❓ FAQ
### Why is the `.env` file not loading my environment variables successfully?