logical/framework: add methods to look up secret and gen response

This commit is contained in:
Mitchell Hashimoto
2015-03-19 14:59:01 +01:00
parent ef56daa3bc
commit b5757ae49a
5 changed files with 130 additions and 2 deletions

View File

@@ -106,6 +106,17 @@ func (b *Backend) Route(path string) *Path {
return result
}
// Secret is used to look up the secret with the given type.
func (b *Backend) Secret(k string) *Secret {
for _, s := range b.Secrets {
if s.Type == k {
return s
}
}
return nil
}
func (b *Backend) init() {
b.pathsRe = make([]*regexp.Regexp, len(b.Paths))
for i, p := range b.Paths {