logical/consul: config/access is the new path for config
This commit is contained in:
parent
23a156b414
commit
517236ea50
|
@ -14,13 +14,13 @@ func Backend() *framework.Backend {
|
|||
b.Backend = &framework.Backend{
|
||||
PathsSpecial: &logical.Paths{
|
||||
Root: []string{
|
||||
"config",
|
||||
"config/*",
|
||||
"policy/*",
|
||||
},
|
||||
},
|
||||
|
||||
Paths: []*framework.Path{
|
||||
pathConfig(),
|
||||
pathConfigAccess(),
|
||||
pathPolicy(),
|
||||
pathToken(&b),
|
||||
},
|
||||
|
|
|
@ -84,7 +84,7 @@ func testAccStepConfig(
|
|||
t *testing.T, config map[string]interface{}) logicaltest.TestStep {
|
||||
return logicaltest.TestStep{
|
||||
Operation: logical.WriteOperation,
|
||||
Path: "config",
|
||||
Path: "config/access",
|
||||
Data: config,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
)
|
||||
|
||||
func client(s logical.Storage) (*api.Client, error) {
|
||||
entry, err := s.Get("config")
|
||||
entry, err := s.Get("config/access")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ func client(s logical.Storage) (*api.Client, error) {
|
|||
"them at the '/root' endpoint")
|
||||
}
|
||||
|
||||
var conf config
|
||||
var conf accessConfig
|
||||
if err := entry.DecodeJSON(&conf); err != nil {
|
||||
return nil, fmt.Errorf("error reading root configuration: %s", err)
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"github.com/hashicorp/vault/logical/framework"
|
||||
)
|
||||
|
||||
func pathConfig() *framework.Path {
|
||||
func pathConfigAccess() *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "config",
|
||||
Pattern: "config/access",
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"address": &framework.FieldSchema{
|
||||
Type: framework.TypeString,
|
||||
|
@ -31,14 +31,14 @@ func pathConfig() *framework.Path {
|
|||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.WriteOperation: pathConfigWrite,
|
||||
logical.WriteOperation: pathConfigAccessWrite,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pathConfigWrite(
|
||||
func pathConfigAccessWrite(
|
||||
req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
|
||||
entry, err := logical.StorageEntryJSON("config", config{
|
||||
entry, err := logical.StorageEntryJSON("config/access", accessConfig{
|
||||
Address: data.Get("address").(string),
|
||||
Scheme: data.Get("scheme").(string),
|
||||
Token: data.Get("token").(string),
|
||||
|
@ -54,7 +54,7 @@ func pathConfigWrite(
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
type config struct {
|
||||
type accessConfig struct {
|
||||
Address string `json:"address"`
|
||||
Scheme string `json:"scheme"`
|
||||
Token string `json:"token"`
|
||||
|
|
Loading…
Reference in New Issue