Skip to content

Commit

Permalink
Merge pull request #61 from Yeti-or/yeti-or.fix-build
Browse files Browse the repository at this point in the history
fix: missing config.js
  • Loading branch information
motdotla authored Feb 4, 2022
2 parents a2f1279 + cc198df commit 654636e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,27 @@ That's it. `process.env` now has the expanded keys and values you defined in you

### Preload

You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv & dotenv-extend. By doing this, you do not need to require and load dotenv or dotenv-extend in your application code. This is the preferred approach when using `import` instead of `require`.
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv & dotenv-
. By doing this, you do not need to require and load dotenv or dotenv-expand in your application code. This is the preferred approach when using `import` instead of `require`.

```bash
$ node -r dotenv-extend/config your_script.js
$ node -r dotenv-expand/config your_script.js
```

The configuration options below are supported as command line arguments in the format `dotenv_config_<option>=value`

```bash
$ node -r dotenv-extend/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars
$ node -r dotenv-expand/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars
```

Additionally, you can use environment variables to set configuration options. Command line arguments will precede these.

```bash
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv-extend/config your_script.js
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv-expand/config your_script.js
```

```bash
$ DOTENV_CONFIG_ENCODING=latin1 node -r dotenv-extend/config your_script.js dotenv_config_path=/custom/path/to/.env
$ DOTENV_CONFIG_ENCODING=latin1 node -r dotenv-expand/config your_script.js dotenv_config_path=/custom/path/to/.env
```

## Examples
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"types": "./lib/main.d.ts",
"default": "./lib/main.js"
},
"./config": "./config.js",
"./config.js": "./config.js",
"./package.json": "./package.json"
},
"scripts": {
Expand Down

0 comments on commit 654636e

Please sign in to comment.