mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
logical/postgresql: leasing
This commit is contained in:
@@ -27,6 +27,7 @@ func Backend() *framework.Backend {
|
||||
|
||||
Paths: []*framework.Path{
|
||||
pathConfigConnection(&b),
|
||||
pathConfigLease(&b),
|
||||
pathRoles(&b),
|
||||
pathRoleCreate(&b),
|
||||
},
|
||||
@@ -95,6 +96,24 @@ func (b *backend) ResetDB() {
|
||||
b.db = nil
|
||||
}
|
||||
|
||||
// Lease returns the lease information
|
||||
func (b *backend) Lease(s logical.Storage) (*configLease, error) {
|
||||
entry, err := s.Get("config/lease")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if entry == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var result configLease
|
||||
if err := entry.DecodeJSON(&result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &result, nil
|
||||
}
|
||||
|
||||
const backendHelp = `
|
||||
The PostgreSQL backend dynamically generates database users.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user