Name: envman
Owner: Bitrise
Description: Environment variable manager
Created: 2015-06-05 15:02:28.0
Updated: 2018-01-16 11:56:33.0
Pushed: 2018-03-12 14:53:16.0
Homepage: null
Size: 3821
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Manage your Environment Variable collections. Switch between Environment Variable sets quickly and easily, or run a single command with a pre-defined set of Environment Variables.
envman
can also be used as a bridge between separate tools, one tool can register its
outputs through envman
and the next tool can access these as simple environment variables.
Public Beta: this repository is still under active development, frequent changes are expected, but we we don't plan to introduce breaking changes, unless really necessary. Feedback is greatly appreciated!
Part of the Bitrise Continuous Integration, Delivery and Automations Stack, with bitrise and stepman.
envman
makes this easy, you don't have to encode the value so that when you call bash's export KEY=value
it will store your value as you intended. You can just give envman
the value as it is through a --valuefile
option or as an input stream (or just edit the related .envstore
file manually), no encoding required.envman
Check the latest release for instructions at: https://github.com/bitrise-io/envman/releases
packer
in your $HOME
dir, in a bin subdir and terraform in another.envset
to include these in your $PATH
docker build -t envman .
docker run --rm -it -v
pwd:/go/src/github.com/bitrise-io/envman --name envman-dev envman /bin/bash
Or use the included scripts:
bash _scripts/docker_build_and_run.sh
bash _scripts/docker_run.sh
envman
will run the command you specify
with the environments found in its environment store.
When you add a new key-value pair with envman add
it stores
the key and value in an .envstore
file in the current
directory (this can be changed), and when you call envman run
the next time the environments in the .envstore
file will
be loaded for the command, and the command will be executed
with an environment which includes the specified environment
variables.
This is the same as you would manually set all the
environments, one by one with export KEY=value
(in bash)
before calling the command.
envman
makes it easy to switch between environment sets
and to isolate these environment sets from each other -
you don't have to unset
environments, the specified
environment set will only be available for that single
run of envman
/ the command and won't affect subsequent
calls of the command or envman
.
Add/store an environment variable:
an add --key MY_TEST_ENV_KEY --value 'test value for test key'
Echo it:
an run bash -c 'echo "Environment test: $MY_TEST_ENV_KEY"'
Why bash -c
is required? Because echo
in itself
does not do any environment expansion, it simply prints
its input. So if you want to see the value of an environment
you have to run it through a tool/shell which actually
performs the environment expansion (replaces the environment
key with the value associated with it).
--value
flagem( "envman add --key SOME_KEY --value 'some value' --expand false" )
open('envman add --key SOME_KEY', 'r+') {|f|
f.write('some value')
f.close_write
f.read
ire 'tempfile'
= Tempfile.new('SOME_FILE_NAME')
.write('some value')
.close
em( "envman add --key SOME_KEY --valuefile #{file.path}" )
.unlink
--value
flagrt "os/exec"
exec.Command("envman", "add", "--key", "SOME_KEY", "--value", "some value")
:= c.Run()
rr != nil {
/ Handle error
rt "os/exec"
RunPipedEnvmanAdd(keyStr, valueStr string) error {
envman := exec.Command("envman", "add", "--key", keyStr)
envman.Stdin = strings.NewReader(valueStr)
envman.Stdout = os.Stdout
envman.Stderr = os.Stderr
return envman.Run()
:= RunPipedEnvmanAdd("SOME_KEY", "some value")
rr != nil {
// Handle error
rt (
"os/exec"
"fmt"
exec.Command("envman", "add", "--key", "SOME_KEY", "--valuefile", "/path/to/file/which/contains/the/value")
:= c.Run()
rr != nil {
// Handle error
--value
flagan add --key SOME_KEY --value 'some value'
"some value" | envman add --key SOME_KEY
an add --key SOME_KEY --valuefile /path/to/file/which/contains/the/value --expand false
bitrise run dep-update
)master
branchRELEASE_VERSION
in bitrise.ymlmaster
branchbitrise run create-release
Release Notes
section in CHANGELOG.md
master
branchcreate-release
workflow run's buildenvman version --full
)Release Notes
and Install or upgrade
sections to the release description on githubPublish release
button on github