Skip to content

Commit

Permalink
added namespace support
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Garner committed Nov 9, 2019
1 parent 469e36a commit e2c3b6b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/erase.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ var eraseCmd = &cobra.Command{
return errors.New("Missing VAULT_ADDR environment variable")
}

vaultNamespace := os.Getenv("VAULT_NAMESPACE")
if vaultNamespace != "" {
vaultAddr += "/"
vaultAddr += vaultNamespace
}

if err := backend.Erase(vaultAddr); err != nil {
return err
}
Expand Down
6 changes: 6 additions & 0 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ var getCmd = &cobra.Command{
return errors.New("Missing VAULT_ADDR environment variable")
}

vaultNamespace := os.Getenv("VAULT_NAMESPACE")
if vaultNamespace != "" {
vaultAddr += "/"
vaultAddr += vaultNamespace
}

token, err := backend.Get(vaultAddr)
if err != nil {
return err
Expand Down
6 changes: 6 additions & 0 deletions cmd/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ var storeCmd = &cobra.Command{
return errors.New("Missing VAULT_ADDR environment variable")
}

vaultNamespace := os.Getenv("VAULT_NAMESPACE")
if vaultNamespace != "" {
vaultAddr += "/"
vaultAddr += vaultNamespace
}

stdin, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return errors.Wrap(err, "Failed to read token from STDIN")
Expand Down

0 comments on commit e2c3b6b

Please sign in to comment.