mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Make DefaultSystemView StaticSystemView with statically-configured information. Export this from Framework to make it easy to override for testing.
This commit is contained in:
@@ -56,10 +56,13 @@ type Backend struct {
|
||||
// See the built-in AuthRenew helpers in lease.go for common callbacks.
|
||||
AuthRenew OperationFunc
|
||||
|
||||
logger *log.Logger
|
||||
once sync.Once
|
||||
pathsRe []*regexp.Regexp
|
||||
sysconfig logical.SystemView
|
||||
// System provides an interface to access certain system configuration
|
||||
// information, such as globally configured default and max lease TTLs.
|
||||
System logical.SystemView
|
||||
|
||||
logger *log.Logger
|
||||
once sync.Once
|
||||
pathsRe []*regexp.Regexp
|
||||
}
|
||||
|
||||
// OperationFunc is the callback called for an operation on a path.
|
||||
@@ -143,7 +146,7 @@ func (b *Backend) SpecialPaths() *logical.Paths {
|
||||
// Setup is used to initialize the backend with the initial backend configuration
|
||||
func (b *Backend) Setup(config *logical.BackendConfig) (logical.Backend, error) {
|
||||
b.logger = config.Logger
|
||||
b.sysconfig = config.System
|
||||
b.System = config.System
|
||||
return b, nil
|
||||
}
|
||||
|
||||
@@ -157,13 +160,6 @@ func (b *Backend) Logger() *log.Logger {
|
||||
return log.New(ioutil.Discard, "", 0)
|
||||
}
|
||||
|
||||
// SystemConfig can be used to get an object that provides methods for
|
||||
// looking up some system configuration information, such as the global
|
||||
// max lease.
|
||||
func (b *Backend) SystemConfig() logical.SystemView {
|
||||
return b.sysconfig
|
||||
}
|
||||
|
||||
// Route looks up the path that would be used for a given path string.
|
||||
func (b *Backend) Route(path string) *Path {
|
||||
result, _ := b.route(path)
|
||||
|
||||
Reference in New Issue
Block a user