@toilal/dotx
v1.0.2
Published
Bridge the gap between shell commands and .env files
Downloads
7
Maintainers
Readme
dotx
Bridge the gap between shell commands and dotenv .env
files.
Install
npm install --global @toilal/dotx
Docs
dotx
can be used to run any command with environment variable loaded from .env
file.
dotx <command>
A custom .env
file can be given:
dotx -f .env.test <command>
You may also set many .env
files.
dotx -f .env -f .env.local <command>
later files have higher priority and will erase variables loaded from previous files
.env
files can be loaded into current shell using the following trick:
eval $(dotx -o export)
You can also grab a single value
MY_VAR=$(dotx -r MY_VAR)
Usage
$ dotx --help
Options:
--help Show help [boolean]
--version Show version number [boolean]
-f, --files .env files to load [array]
-o, --output output environment variable
[string] [choices: "set", "export", "json", "json-pretty"]
-r, --read-value read value for one environment variable [string]
-s, --shell execute the command in shell [boolean]