1
0
mirror of https://github.com/Luzifer/envrun.git synced 2024-09-19 15:42:58 +00:00
Helper utility to inject environment variables stored in a file into processes
Go to file
Knut Ahlers 5ad23dcb8f
Add Gtihub publishing
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-03-21 14:56:38 +01:00
Godeps Vendor dependencies 2017-03-21 14:55:49 +01:00
vendor Vendor dependencies 2017-03-21 14:55:49 +01:00
.gobuilder.yml Initial version 2016-02-06 16:23:11 +01:00
.repo-runner.yaml Add Gtihub publishing 2017-03-21 14:56:38 +01:00
History.md prepare release v0.3.0 2017-03-21 14:55:20 +01:00
main.go Add support for encrypted env files 2017-03-21 14:54:59 +01:00
Makefile Add Gtihub publishing 2017-03-21 14:56:38 +01:00
README.md Fix: Missing link in README 2016-02-06 16:25:20 +01:00

Luzifer / envrun

envrun is a small helper utility I wrote for myself to debug programs and scripts during their development expecting environment variables to be set to special values. Sure there is gin for go webservers doing the same but I wanted something also for commandline utilities.

It reads a .env file (configurable) from the current directory and then either takes its own environment variables or a clean set and adds the env variables found in .env to it. The resulting set is passed to the command you put as arguments to envrun.

Examples

To visualize the effect of the utility the test command is python test.py with this simple python script:

import os

for k in os.environ.keys():
  print "{} = {}".format(k, os.environ[k])

It just prints the current environment to STDOUT and exits.

# cat .env
MY_TEST_VAR=hello world
ANOTHER_VAR=foo

# python test.py | grep MY_TEST_VAR
## No output on this command

# envrun --help
Usage of envrun:
      --clean[=false]: Do not pass current environment to child process
      --env-file=".env": Location of the environment file
      --q[=false]: Suppress informational messages from envrun

# envrun python test.py | grep MY_TEST_VAR
MY_TEST_VAR = hello world

# envrun python test.py | wc -l
      45

# envrun --clean python test.py | wc -l
       3

# envrun --clean python test.py
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0
ANOTHER_VAR = foo
MY_TEST_VAR = hello world