From c64fa046daab2239e83fe30194bf13a6a9a86fe9 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 21 Apr 2017 21:50:31 +0200 Subject: [PATCH] Update README for new version Signed-off-by: Knut Ahlers --- README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 646ae04..802be25 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,32 @@ -[![Download on GoBuilder](http://badge.luzifer.io/v1/badge?title=Download%20on&text=GoBuilder)](https://gobuilder.me/github.com/Luzifer/vault2env) -[![License: Apache v2.0](https://badge.luzifer.io/v1/badge?color=5d79b5&title=license&text=Apache+v2.0)](http://www.apache.org/licenses/LICENSE-2.0) +![License](https://badges.fyi/github/license/Luzifer/vault2env) [![Go Report Card](https://goreportcard.com/badge/github.com/Luzifer/vault2env)](https://goreportcard.com/report/github.com/Luzifer/vault2env) # Luzifer / vault2env -`vault2env` is a really small utility to transfer fields of a key in [Vault](https://www.vaultproject.io/) into the environment. It uses the [`app-role`](https://www.vaultproject.io/docs/auth/approle.html), [`app-id` authentication mechanism](https://www.vaultproject.io/docs/auth/app-id.html) or simple [token authentication](https://www.vaultproject.io/docs/auth/token.html) to identify itself with the Vault server, fetches all fields in the specified key and returns export directives for bash / zsh. That way you can do `eval` stuff and pull those fields into your ENV. +`vault2env` is a really small utility to transfer fields of a key in [Vault](https://www.vaultproject.io/) into the environment. It uses the [`app-role`](https://www.vaultproject.io/docs/auth/approle.html) or simple [token authentication](https://www.vaultproject.io/docs/auth/token.html) to identify itself with the Vault server, fetches all fields in the specified keys and returns export directives for bash / zsh. That way you can do `eval` stuff and pull those fields into your ENV. If you don't want to use export directives you also can pass commands to `vault2env` to be executed using those environment variables. ## Usage In general this program can either output your ENV variables to use with `eval` or similar or it can run a program with populated environment. ``` -# vault2env [secret path] [command] +# vault2env --key= -# vault2env --export [secret path] +# vault2env --export --key= export ... ``` ### Using evironment variables ```bash # export VAULT_ADDR="https://127.0.0.1:8200" -# export VAULT_APP_ID="29c8febe-49f5-4620-a177-20dff0fda2da" -# export VAULT_USER_ID="54d24f66-6ecb-4dcc-bdb7-0241a955f1df" -# vault2env --export secret/my/path/with/keys +# export VAULT_ROLE_ID="29c8febe-49f5-4620-a177-20dff0fda2da" +# export VAULT_SECRET_ID="54d24f66-6ecb-4dcc-bdb7-0241a955f1df" +# vault2env --export --key=secret/my/path/with/keys export FIRST_KEY="firstvalue" export SECOND_KEY="secondvalue" -# eval $(vault2env --export secret/my/path/with/keys) + +# eval $(vault2env --export --key=secret/my/path/with/keys) # echo "${FIRST_KEY}" firstvalue ``` @@ -36,11 +36,10 @@ firstvalue The command does differ only with its parameters specified for the different authentication mechanisms: - When using AppRole you need to specify `--vault-role-id` and optionally `--vault-secret-id` if you're using the `bind_secret_id` flag for your AppRole -- When using AppID specify `--vault-app-id` and `--vault-user-id` - When using Token auth only specify `--vault-token` ```bash -# vault2env --vault-addr="..." --vault-app-id="..." --vault-user-id="..." secret/my/path/with/keys +# vault2env --vault-addr="..." --vault-app-id="..." --vault-user-id="..." --key=secret/my/path/with/keys export FIRST_KEY="firstvalue" export SECOND_KEY="secondvalue" ```