Revert couchdb changes

This commit is contained in:
Jeff Mitchell 2017-10-26 15:26:54 -04:00
parent 5d1e06ae93
commit 9973d28293
4 changed files with 2 additions and 59 deletions

View file

@ -22,7 +22,6 @@ import (
// CouchDBBackend allows the management of couchdb users
type CouchDBBackend struct {
logger log.Logger
prefix string
client *couchDBClient
permitPool *physical.PermitPool
}
@ -159,12 +158,6 @@ func buildCouchDBBackend(conf map[string]string, logger log.Logger) (*CouchDBBac
username = conf["username"]
}
prefix := "$"
prefixedStr, ok := conf["prefixed"]
if ok {
prefix = prefixedStr
}
password := os.Getenv("COUCHDB_PASSWORD")
if password == "" {
password = conf["password"]
@ -190,7 +183,6 @@ func buildCouchDBBackend(conf map[string]string, logger log.Logger) (*CouchDBBac
password: password,
Client: cleanhttp.DefaultPooledClient(),
},
prefix: prefix,
logger: logger,
permitPool: physical.NewPermitPool(maxParInt),
}, nil
@ -235,10 +227,6 @@ func (m *CouchDBBackend) Delete(key string) error {
func (m *CouchDBBackend) List(prefix string) ([]string, error) {
defer metrics.MeasureSince([]string{"couchdb", "list"}, time.Now())
if m.prefix != "" {
prefix = m.prefix + prefix
}
m.permitPool.Acquire()
defer m.permitPool.Release()
@ -287,10 +275,6 @@ func NewTransactionalCouchDBBackend(conf map[string]string, logger log.Logger) (
func (m *CouchDBBackend) GetInternal(key string) (*physical.Entry, error) {
defer metrics.MeasureSince([]string{"couchdb", "get"}, time.Now())
if m.prefix != "" {
key = m.prefix + key
}
return m.client.get(key)
}
@ -298,17 +282,12 @@ func (m *CouchDBBackend) GetInternal(key string) (*physical.Entry, error) {
func (m *CouchDBBackend) PutInternal(entry *physical.Entry) error {
defer metrics.MeasureSince([]string{"couchdb", "put"}, time.Now())
key := entry.Key
if m.prefix != "" {
key = m.prefix + entry.Key
}
revision, _ := m.client.rev(url.PathEscape(key))
revision, _ := m.client.rev(url.PathEscape(entry.Key))
return m.client.put(couchDBEntry{
Entry: entry,
Rev: revision,
ID: url.PathEscape(key),
ID: url.PathEscape(entry.Key),
})
}
@ -316,10 +295,6 @@ func (m *CouchDBBackend) PutInternal(entry *physical.Entry) error {
func (m *CouchDBBackend) DeleteInternal(key string) error {
defer metrics.MeasureSince([]string{"couchdb", "delete"}, time.Now())
if m.prefix != "" {
key = m.prefix + key
}
revision, _ := m.client.rev(url.PathEscape(key))
deleted := true
return m.client.put(couchDBEntry{

View file

@ -30,11 +30,6 @@ storage "couchdb" {
## `couchdb` Parameters
- `prefix` `(string: "$")` Specifies a prefix to use for each value written
to CouchDB. If turned off (by setting to `""`, Vault may run into error
conditions if values are written that begin with an underscore, since it is a
reserved prefix in CouchDB.
- `endpoint` `(string: "")` Specifies your CouchDB endpoint. This can also be
provided via the environment variable `COUCHDB_ENDPOINT`.

View file

@ -1,24 +0,0 @@
---
layout: "guides"
page_title: "Upgrading to Vault 0.9.0 - Guides"
sidebar_current: "guides-upgrading-to-0.9.0"
description: |-
This page contains the list of deprecations and important or breaking changes
for Vault 0.9.0. Please read it carefully.
---
# Overview
This page contains the list of deprecations and important or breaking changes
for Vault 0.9.0 compared to the most recent release. Please read it carefully.
## CouchDB Storage Changes
Vault may write values to storage that start with an underscore (`_`)
character. This is a reserved character in CouchDB, which can cause breakage.
As a result, this backend now stores each value prefixed with a `$` character.
If you are upgrading from existing CouchDB usage, you can turn off this
behavior by setting the `"prefixed"` configuration value to `"false"`.
Alternately, if you need to handle underscores at the start of keys, you can
rewrite your existing keys to start with a `$` character.

View file

@ -53,9 +53,6 @@
<li<%= sidebar_current("guides-upgrading-to-0.8.0") %>>
<a href="/guides/upgrading/upgrade-to-0.8.0.html">Upgrade to 0.8.0</a>
</li>
<li<%= sidebar_current("guides-upgrading-to-0.9.0") %>>
<a href="/guides/upgrading/upgrade-to-0.9.0.html">Upgrade to 0.9.0</a>
</li>
</ul>
</li>
</ul>