From 6a1c142924f5f3bf2692efcb6e022fabb6a78497 Mon Sep 17 00:00:00 2001 From: Tim Schindler Date: Thu, 30 Jun 2016 18:46:00 +0000 Subject: [PATCH 1/5] added ETCD_ADDR env var to etcd backend --- physical/etcd.go | 4 ++++ physical/etcd_test.go | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/physical/etcd.go b/physical/etcd.go index 4bb368aac..e431633d6 100644 --- a/physical/etcd.go +++ b/physical/etcd.go @@ -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 diff --git a/physical/etcd_test.go b/physical/etcd_test.go index f39312486..1e7e67137 100644 --- a/physical/etcd_test.go +++ b/physical/etcd_test.go @@ -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 explitely. 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) From 24c6a605ea5c3fe06ca4b9b3b98a3b318589dfd0 Mon Sep 17 00:00:00 2001 From: Tim Schindler Date: Thu, 30 Jun 2016 18:46:40 +0000 Subject: [PATCH 2/5] added documentation about ETCD_ADDR env var to etcd backend documentation --- website/source/docs/commands/environment.html.md | 2 +- website/source/docs/config/index.html.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/website/source/docs/commands/environment.html.md b/website/source/docs/commands/environment.html.md index 928d2d9ee..bbc9f48eb 100644 --- a/website/source/docs/commands/environment.html.md +++ b/website/source/docs/commands/environment.html.md @@ -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: diff --git a/website/source/docs/config/index.html.md b/website/source/docs/config/index.html.md index ad43fc0f5..0e576675f 100644 --- a/website/source/docs/config/index.html.md +++ b/website/source/docs/config/index.html.md @@ -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 @@ -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". -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) From 23f08a139ce99ad060e36b1a46f9b03ebd1ebd95 Mon Sep 17 00:00:00 2001 From: Tim Schindler Date: Thu, 30 Jun 2016 18:53:55 +0000 Subject: [PATCH 3/5] os.GetEnv -> os.Getenv --- physical/etcd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physical/etcd.go b/physical/etcd.go index e431633d6..4f88182d8 100644 --- a/physical/etcd.go +++ b/physical/etcd.go @@ -89,7 +89,7 @@ func newEtcdBackend(conf map[string]string, logger *log.Logger) (Backend, error) if address, ok := conf["address"]; ok { machines = address } - machinesEnv := os.GetEnv("ETCD_ADDR") + machinesEnv := os.Getenv("ETCD_ADDR") if machinesEnv != "" { machines = machinesEnv } From b00535bcf57313f7a85a859832a5b55bef8ee526 Mon Sep 17 00:00:00 2001 From: Tim Schindler Date: Thu, 30 Jun 2016 19:10:15 +0000 Subject: [PATCH 4/5] fixed typo: explitely -> explicitly --- physical/etcd_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physical/etcd_test.go b/physical/etcd_test.go index 1e7e67137..36ca26e8c 100644 --- a/physical/etcd_test.go +++ b/physical/etcd_test.go @@ -47,7 +47,7 @@ func TestEtcdBackend(t *testing.T) { }() // Generate new etcd backend. The etcd address is read from ETCD_ADDR. No - // need to provide it explitely. + // need to provide it explicitly. logger := log.New(os.Stderr, "", log.LstdFlags) b, err := NewBackend("etcd", logger, map[string]string{ "path": randPath, From b86e00540306d5fa9eb4349656277d85b354d438 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Thu, 30 Jun 2016 16:45:29 -0400 Subject: [PATCH 5/5] changelog++ --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e7d1f324..555bf3814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ IMPROVEMENTS: [GH-1567] * credential/aws-ec2: Added a new constraint, 'bound_account_id' to the role [GH-1523] + * physical/etcd: Support `ETCD_ADDR` env var for specifying addresses [GH-1576] * secret/aws: Listing of roles is supported now [GH-1546] * secret/mssql,mysql,postgresql: Reading of connection settings is supported in all the sql backends [GH-1515]