Skip to content

Commit

Permalink
Merge pull request kelseyhightower#153 from bassamtabbara/read-etcd-p…
Browse files Browse the repository at this point in the history
…eers-from-env

set nodes config from ETCDCTL_PEERS if specified
  • Loading branch information
kelseyhightower committed Oct 19, 2014
2 parents f5f71d4 + 6db3c58 commit 0d1283f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ func initConfig() error {
case "consul":
config.BackendNodes = []string{"127.0.0.1:8500"}
case "etcd":
config.BackendNodes = []string{"http://127.0.0.1:4001"}
peerstr := os.Getenv("ETCDCTL_PEERS")
if len(peerstr) > 0 {
config.BackendNodes = strings.Split(peerstr, ",")
} else {
config.BackendNodes = []string{"http://127.0.0.1:4001"}
}
}
}
// Initialize the storage client
Expand Down

0 comments on commit 0d1283f

Please sign in to comment.