mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-04 14:25:35 -04:00
physical: Default consul path to vault/
This commit is contained in:
parent
1d2feafee3
commit
0d666e755c
1 changed files with 7 additions and 2 deletions
|
|
@ -22,12 +22,17 @@ type ConsulBackend struct {
|
|||
func newConsulBackend(conf map[string]string) (Backend, error) {
|
||||
// Get the path in Consul
|
||||
path, ok := conf["path"]
|
||||
if !ok || path == "" || path == "/" {
|
||||
return nil, fmt.Errorf("'path' must be set")
|
||||
if !ok {
|
||||
path = "vault/"
|
||||
}
|
||||
|
||||
// Ensure path is suffixed but not prefixed
|
||||
if !strings.HasSuffix(path, "/") {
|
||||
path += "/"
|
||||
}
|
||||
if strings.HasPrefix(path, "/") {
|
||||
path = strings.TrimPrefix(path, "/")
|
||||
}
|
||||
|
||||
// Configure the client
|
||||
consulConf := api.DefaultConfig()
|
||||
|
|
|
|||
Loading…
Reference in a new issue