1.0.1 • Published 1 year ago

dotenv-shell v1.0.1

Weekly downloads
127
License
MIT
Repository
github
Last release
1 year ago

dotenv-shell

Build Master

A package that expands shell commands from a dotenv config.

Install

npm install dotenv
npm install dotenv-shell

Usage

Wrap dotenv-shell around dotenv to expand shell commands.

You .env file should look something like this:

BASIC=`echo basic`

You script should look something like this:

const dotenv = require('dotenv')
const dotenvExpand = require('dotenv-shell')
const config = dotenv.config();
dotenvShell(config);
console.log(config);
// { parsed: { BASIC: 'basic' } }

You can further expand with the dotenv-expand package.

npm install dotenv
npm install dotenv-shell
npm install dotenv-expand
EXPAND=basic
BASIC=`echo ${EXPAND}`
const config = dotenvShell(dotenvExpand(dotenv.config()));
console.log(config);
// { parsed: { EXPAND: 'basic', BASIC: 'basic' } }

Breaking change from dotenv

Comments begin where a # exists, so if your value contains a # please wrap it in quotes. This is a breaking change from >= v15.0.0 and on.

# This is a comment
SECRET_KEY=YOURSECRETKEYGOESHERE # comment
SECRET_HASH="something-with-a-#-hash"

Notes

Please request features or report problems using the issues page.

License

See the included LICENSE for rights and limitations under the terms of the MIT license.

1.0.1

1 year ago

1.0.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago