diff --git a/README.md b/README.md index f2dbe98f..6edb27ad 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,19 @@ Find the corresponding binaries, `.rpm` and `.deb` packages in the [release](htt # Authentication `vkv` supports token based authentication. It is clear that you can only see the secrets that are allowed by your token policy. +## Required Environment Variables In order to authenticate to a Vault instance you have to export `VAULT_ADDR` and `VAULT_TOKEN`. ```bash VAULT_ADDR="http://127.0.0.1:8200" VAULT_TOKEN="root" vkv ``` -Furthermore you can export `VAULT_SKIP_VERIFY` for insecure HTTPS connection. Also `vkv` respects `HTTP_PROXY` and `HTTPS_PROXY` environment variables. +## Optional Environment Variables +Furthermore you can export: + +* `VAULT_NAMESPACE` for namespace login +* `VAULT_SKIP_VERIFY` for insecure HTTPS connection +* `HTTP_PROXY` and `HTTPS_PROXY` for proxy connections. # Usage ```bash diff --git a/pkg/vault/vault.go b/pkg/vault/vault.go index dc0fbc8b..460b6338 100644 --- a/pkg/vault/vault.go +++ b/pkg/vault/vault.go @@ -62,9 +62,15 @@ func NewClient() (*Vault, error) { c.SetToken(vaultToken) + vaultNamespace, ok := os.LookupEnv("VAULT_NAMESPACE") + if ok { + c.SetNamespace(vaultNamespace) + } + return &Vault{Client: c, Secrets: make(map[string]interface{})}, nil } +// ListRecursive returns secrets to a path recursive. func (v *Vault) ListRecursive(rootPath, subPath string) error { keys, err := v.ListSecrets(rootPath, subPath) if err != nil {