Skip to content

Commit

Permalink
Merge pull request #4 from Shopify/update-readme
Browse files Browse the repository at this point in the history
adds more documentation
  • Loading branch information
catherinejones authored Sep 13, 2018
2 parents 68218f4 + 777a51f commit 0980893
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 3 deletions.
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,83 @@

# ejson2env

`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](https://github.com/Shopify/ejson) 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:

```json
{
"_public_key": "<public key here>",
"environment": {
"SECRET_SHELL_VARIABLE": "<encrypted data>"
}
}
```

Running:

```shell
$ ejson test.ejson
```

Would result in the following output:

```
export SECRET_SHELL_VARIABLE=<decrypted data>
```

You can then have your shell evaluate this output:

```shell
$ eval $(ejson test.ejson)
```

## Using ejson2env

`ejson2env`'s usage information is described in it's included [manual page](/man/ejson2env.1.ronn).

## Installing ejson2env

`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`.

### Go

`ejson2env` can be installed using the regular `go get` tool:

```shell
$ go get -u github.com/Shopify/ejson2env/cmd/ejson2env
```

You can then find the compiled binary in `$GOPATH/bin`

### Debian Package

You can download the latest version of the Debian package from [the releases page](https://github.com/Shopify/ejson2env/releases).

Install the downloaded package by calling:

```shell
$ dpkg -i ejson2env_1.0.3_amd64.deb
```

### RubyGems

You can install `ejson2env` using Ruby's Gem tool:

```shell
$ gem install ejson2env
```

### Homebrew

Provided your install of Homebrew is configured to pull from [Shopify's Homebrew repo](https://github.com/shopify/homebrew-shopify), you can install `ejson2env` by calling:

```shell
$ brew install ejson2env
```

## Contributing

### Releasing
Expand Down
6 changes: 3 additions & 3 deletions man/ejson2env.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ The following output would be generated for our example:
export DB_PASSWORD=1234password
```

You can then export them to the shell environment by calling the command
surrounded by backticks.
You can then export them to the shell environment by calling the `ejson2env`
command with `eval` command.

For example:

```
#!/bin/sh
`ejson2env /config/secrets.production.ejson`
eval $(ejson2env /config/secrets.production.ejson)
echo $DB_PASSWORD
```
Expand Down

0 comments on commit 0980893

Please sign in to comment.