diff --git a/physical/consul.go b/physical/consul.go index 1defa21336..06099aa266 100644 --- a/physical/consul.go +++ b/physical/consul.go @@ -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()