bashenv

1.0.0 • Public • Published

bashenv

.env files such as dotenv are brilliant!

This is a very simple helper script that makes writing day-to-day bash one-liners a little more readable.

To Use:

yarn global add bashenv

Example

#   Lets assume this is a .env file
NODE_ENV=debug
MY_IP_ADDRESS=127.0.0.1
SECRET_ACCESS_KEY=12345
# Echo each line to the current process
bashenv
# output:
# NODE_ENV=debug
# MY_IP_ADDRESS=127.0.0.1
# SECRET_ACCESS_KEY=12345
# script also EXPORTS each variable it finds,
# You can SOURCE the output, and those variables
# will be available to child processes
source bashenv | bash | echo $SECRET_ACCESS_KEY
# output:  12345

Convienience methods are also available:

# Add / Update a key/value pair like so.
# If no .env file is found, one is created for you
bashenv NODE_ENV production

# Read a specific key value
bashenv MY_IP_ADDRESS
# result:  127.0.0.1

Readme

Keywords

none

Package Sidebar

Install

npm i bashenv

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.91 MB

Total Files

8

Last publish

Collaborators

  • nicholaswagner