ejson2env
is a tool to simplify storing secrets that should be accessible in the shell environment in your git repo. ejson2env
is based on the ejson library and extends the ejson
file format.
ejson2env
exports all of the values in the environment
object in the ejson
file to the shell environment.
For example, with the below ejson
file:
{
"_public_key": "<public key here>",
"environment": {
"SECRET_SHELL_VARIABLE": "<encrypted data>"
}
}
Running:
$ ejson2env test.ejson
Would result in the following output:
export SECRET_SHELL_VARIABLE=<decrypted data>
You can then have your shell evaluate this output:
$ eval $(ejson2env test.ejson)
ejson2env
's usage information is described in it's included --help
flag.
ejson2env
is available through a number of different routes and package managers. If you plan on modifying ejson2env
, it is suggested that you install via go get
.
ejson2env
can be installed using the regular go install
tool:
$ go install github.com/Shopify/ejson2env/v2/cmd/ejson2env@latest
You can then find the compiled binary in $GOPATH/bin
You can download the latest version of the Debian package from the releases page.
Install the downloaded package by calling:
$ dpkg -i ejson2env_1.0.3_amd64.deb
You can install ejson2env
using Ruby's Gem tool:
$ gem install ejson2env
Provided your install of Homebrew is configured to pull from Shopify's Homebrew repo, you can install ejson2env
by calling:
$ brew install ejson2env
Please review the Contributing document if you are interested in helping improve ejson2env!