Skip to content

Commit

Permalink
fix bug looking up versioned vault secrets
Browse files Browse the repository at this point in the history
The brains/cache is keyed off String() output of a dependency. In this
case the dependency is a versioned vault secret. The problem is that the
vault secret's String() output doesn't contain the version. So the first
version retrieved seeds the cache and all subsequent references use that
version even if they specify a different (or no) version.

Including the version in vault secret String() output fixes this.
  • Loading branch information
eikenb committed Mar 5, 2020
1 parent 4789984 commit f54cce4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dependency/vault_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ func (d *VaultReadQuery) Stop() {

// String returns the human-friendly version of this dependency.
func (d *VaultReadQuery) String() string {
if v := d.queryValues["version"]; len(v) > 0 {
return fmt.Sprintf("vault.read(%s.v%s)", d.rawPath, v[0])
}
return fmt.Sprintf("vault.read(%s)", d.rawPath)
}

Expand Down

0 comments on commit f54cce4

Please sign in to comment.