mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
Add logic to skip initialization in some cases and some invalidation logic
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/hashicorp/vault/helper/salt"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
)
|
||||
@@ -21,7 +20,6 @@ func Factory(conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
|
||||
type backend struct {
|
||||
*framework.Backend
|
||||
Salt *salt.Salt
|
||||
|
||||
// Used during initialization to set the salt
|
||||
view logical.Storage
|
||||
@@ -105,24 +103,11 @@ func Backend(conf *logical.BackendConfig) (*backend, error) {
|
||||
},
|
||||
|
||||
Invalidate: b.invalidate,
|
||||
|
||||
Init: b.initialize,
|
||||
}
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (b *backend) initialize() error {
|
||||
salt, err := salt.NewSalt(b.view, &salt.Config{
|
||||
HashFunc: salt.SHA256Hash,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.Salt = salt
|
||||
return nil
|
||||
}
|
||||
|
||||
// periodicFunc performs the tasks that the backend wishes to do periodically.
|
||||
// Currently this will be triggered once in a minute by the RollbackManager.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user