File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 "net/http"
99 "os"
1010 "os/exec"
11+ "strconv"
1112 "strings"
1213 "time"
1314
2223 retrySleep = 200 * time .Millisecond
2324)
2425
26+ const (
27+ hostEnvVar = "DEIS_ETCD_1_SERVICE_HOST"
28+ portEnvVar = "DEIS_ETCD_1_SERVICE_PORT_CLIENT"
29+ defaultHost = "http://localhost"
30+ )
31+
2532// Getter describes the Get behavior of an Etcd client.
2633//
2734// Usually you will want to use go-etcd/etcd.Client to satisfy this.
@@ -64,7 +71,19 @@ type GetterSetter interface {
6471// Returns:
6572// This puts an *etcd.Client into the context.
6673func CreateClient (c cookoo.Context , p * cookoo.Params ) (interface {}, cookoo.Interrupt ) {
67- url := p .Get ("url" , "http://localhost:4001" ).(string )
74+ host := os .Getenv (hostEnvVar )
75+ port , err := strconv .Atoi (os .Getenv (portEnvVar ))
76+ if host == "" {
77+ host = defaultHost
78+ }
79+ if err != nil {
80+ port = 4001
81+ }
82+
83+ // Aaron(12/9/2015): to shame me into fixing this later, but it's a bigger change
84+ fmt .Println ("Aaron hasn't fixed the env var collection stage in the cookoo route yet..." )
85+ // url := p.Get("url", "http://localhost:4001").(string)
86+ url := fmt .Sprintf ("%s:%d" , host , port )
6887
6988 // Backed this out because it's unnecessary so far.
7089 //hosts := p.Get("urls", []string{"http://localhost:4001"}).([]string)
You can’t perform that action at this time.
0 commit comments