physical: Default consul path to vault/

This commit is contained in:
Armon Dadgar 2015-04-03 17:05:18 -07:00
parent 1d2feafee3
commit 0d666e755c

View file

@ -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()