Merge pull request #1576 from xh3b4sd/etcd-addr-env

Etcd addr env
This commit is contained in:
Jeff Mitchell 2016-06-30 22:44:54 +02:00 committed by GitHub
commit 60f3c8caae
4 changed files with 11 additions and 5 deletions

View file

@ -89,6 +89,10 @@ func newEtcdBackend(conf map[string]string, logger *log.Logger) (Backend, error)
if address, ok := conf["address"]; ok { if address, ok := conf["address"]; ok {
machines = address machines = address
} }
machinesEnv := os.Getenv("ETCD_ADDR")
if machinesEnv != "" {
machines = machinesEnv
}
machinesParsed := strings.Split(machines, EtcdMachineDelimiter) machinesParsed := strings.Split(machines, EtcdMachineDelimiter)
// Verify that the machines are valid URLs // Verify that the machines are valid URLs

View file

@ -46,10 +46,11 @@ func TestEtcdBackend(t *testing.T) {
} }
}() }()
// Generate new etcd backend. The etcd address is read from ETCD_ADDR. No
// need to provide it explicitly.
logger := log.New(os.Stderr, "", log.LstdFlags) logger := log.New(os.Stderr, "", log.LstdFlags)
b, err := NewBackend("etcd", logger, map[string]string{ b, err := NewBackend("etcd", logger, map[string]string{
"address": addr, "path": randPath,
"path": randPath,
}) })
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)

View file

@ -9,7 +9,7 @@ description: |-
# Environment variables # Environment variables
The Vault CLI will read the following environment variables to set The Vault CLI will read the following environment variables to set
behavioral defaults. These can be overridden in all cases using behavioral defaults. These can be overridden in all cases using
command-line arguments; see the command-line help for details. command-line arguments; see the command-line help for details.
The following table describes them: The following table describes them:

View file

@ -331,7 +331,8 @@ For etcd, the following options are supported:
* `address` (optional) - The address(es) of the etcd instance(s) to talk to. * `address` (optional) - The address(es) of the etcd instance(s) to talk to.
Can be comma separated list (protocol://host:port) of many etcd instances. Can be comma separated list (protocol://host:port) of many etcd instances.
Defaults to "http://localhost:2379" if not specified. Defaults to "http://localhost:2379" if not specified. May also be specified
via the ETCD_ADDR environment variable.
* `sync` (optional) - Should we synchronize the list of available etcd * `sync` (optional) - Should we synchronize the list of available etcd
servers on startup? This is a **string** value to allow for auto-sync to servers on startup? This is a **string** value to allow for auto-sync to
@ -473,7 +474,7 @@ profile enabled. Vault will handle renewing profile credentials as they rotate.
* `max_parallel` (optional) - The maximum number of concurrent connections to Azure. Defaults to "128". * `max_parallel` (optional) - The maximum number of concurrent connections to Azure. Defaults to "128".
The current implementation is limited to a maximum of 4 MBytes per blob/file. The current implementation is limited to a maximum of 4 MBytes per blob/file.
#### Backend Reference: Swift (Community-Supported) #### Backend Reference: Swift (Community-Supported)