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 {
machines = address
}
machinesEnv := os.Getenv("ETCD_ADDR")
if machinesEnv != "" {
machines = machinesEnv
}
machinesParsed := strings.Split(machines, EtcdMachineDelimiter)
// 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)
b, err := NewBackend("etcd", logger, map[string]string{
"address": addr,
"path": randPath,
"path": randPath,
})
if err != nil {
t.Fatalf("err: %s", err)

View file

@ -9,7 +9,7 @@ description: |-
# Environment variables
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.
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.
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
servers on startup? This is a **string** value to allow for auto-sync to