runs commands with env stored in dotfile
Run your script with your env
Ultra simple runner that injects vars from the implicit .env file into your commands of choice.
denv COMMAND [ARGS]
Expects a .env file in the current directory of format:
KEY=VALUE FOO=BAR AGE=29 host=hostname=foo user=bar password=false
Create an .env file holding your vars
$ cat .env CONNECTION_STRING=host=foo user=bar password=baz
Use them in posix commands:
$ denv env | grep CONNECTION_STRING host=foo user=bar password=baz
Use them when running python scripts:
$ denv python -c 'import os;print(os.environ["host"])' foo user=bar password=baz
Using environment vars is the accepted practice for injecting these configs into apps during deployment. But running locally i wanted something very simple to inject these env-vars into the runtime myself.
Looking around you will quickly find many implementations:
But i tend to disagree with them in two ways:
- They tend to aim for being a replacement for your runtimes default environment lib and just overload with reading from a file
- Some of them lack support for connection-strings where there can be many =’s per line.
I wanted to seperate it completely so the runtime only cared about env-vars and its standard way of accessing these, and then have the runner inject these vars as the only thing it did.
- `sloev <sloev.github.io>`__
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size denv-1.4.2.tar.gz (3.0 kB)||File type Source||Python version None||Upload date||Hashes View|