37 lines
550 B
Go
37 lines
550 B
Go
|
package consul
|
||
|
|
||
|
import (
|
||
|
"github.com/hashicorp/vault/logical"
|
||
|
"github.com/hashicorp/vault/logical/framework"
|
||
|
)
|
||
|
|
||
|
func Factory(map[string]string) (logical.Backend, error) {
|
||
|
return Backend(), nil
|
||
|
}
|
||
|
|
||
|
func Backend() *framework.Backend {
|
||
|
var b backend
|
||
|
b.Backend = &framework.Backend{
|
||
|
PathsRoot: []string{
|
||
|
"config",
|
||
|
"policy/*",
|
||
|
},
|
||
|
|
||
|
Paths: []*framework.Path{
|
||
|
pathConfig(),
|
||
|
pathPolicy(),
|
||
|
pathToken(&b),
|
||
|
},
|
||
|
|
||
|
Secrets: []*framework.Secret{
|
||
|
secretToken(),
|
||
|
},
|
||
|
}
|
||
|
|
||
|
return b.Backend
|
||
|
}
|
||
|
|
||
|
type backend struct {
|
||
|
*framework.Backend
|
||
|
}
|