Skip to content

Commit

Permalink
Using gomt with -s option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Otávio Fernandes committed Mar 31, 2019
1 parent b4ae117 commit 5b843d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
7 changes: 1 addition & 6 deletions pkg/vault-handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func (h *Handler) persist(file *File) error {

// dispense a data map to a given vault path.
func (h *Handler) dispense(vaultPath string, data map[string]interface{}) error {
var err error
logger := log.WithField("vaultPath", vaultPath)
logger.Info("Uploading secrets to Vault path")

Expand All @@ -160,11 +159,7 @@ func (h *Handler) dispense(vaultPath string, data map[string]interface{}) error
return nil
}

if err = h.vault.Write(vaultPath, data); err != nil {
return err
}

return nil
return h.vault.Write(vaultPath, data)
}

// composeVaultPath based in the current SecretData.
Expand Down
6 changes: 3 additions & 3 deletions pkg/vault-handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const (
var handler *Handler
var handlerManifest = &Manifest{
Secrets: map[string]Secrets{
groupName: Secrets{
groupName: {
Path: "secret/data/test/handler/upload",
Data: []SecretData{
SecretData{Name: "zipped", Extension: "txt", NameAsSubPath: true, Zip: true},
SecretData{Name: "plain", Extension: "txt", NameAsSubPath: true, Zip: false},
{Name: "zipped", Extension: "txt", NameAsSubPath: true, Zip: true},
{Name: "plain", Extension: "txt", NameAsSubPath: true, Zip: false},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/vault-handler/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (v *Vault) Write(path string, data map[string]interface{}) error {

// setHeaders prepare http request headers to inform token.
func (v *Vault) setHeaders() {
headers := map[string][]string{"X-Vault-Token": []string{v.token}}
headers := map[string][]string{"X-Vault-Token": {v.token}}
v.client.SetHeaders(headers)
v.client.SetToken(v.token)
}
Expand Down

0 comments on commit 5b843d6

Please sign in to comment.