Refactor: make weave API a part of the proxy struct

This commit is contained in:
Bryan Boreham committed 2017-05-12 06:56:52 +00:00
1 parent 70929cec57
commit 1b8d115b63
1 file changed
+3 -2
+3 -2
View File
@@ -77,6 +77,7 @@ type Proxy struct {
sync.Mutex sync.Mutex
Config Config
client *docker.Client client *docker.Client
weave *weaveapi.Client
dockerBridgeIP string dockerBridgeIP string
hostnameMatchRegexp *regexp.Regexp hostnameMatchRegexp *regexp.Regexp
weaveWaitVolume string weaveWaitVolume string
@@ -129,6 +130,7 @@ func NewProxy(c Config) (*Proxy, error) {
waiters: make(map[*http.Request]*wait), waiters: make(map[*http.Request]*wait),
attachJobs: make(map[string]*attachJob), attachJobs: make(map[string]*attachJob),
quit: make(chan struct{}), quit: make(chan struct{}),
weave: weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), Log),
} }
if err := p.TLSConfig.LoadCerts(); err != nil { if err := p.TLSConfig.LoadCerts(); err != nil {
@@ -594,8 +596,7 @@ func (proxy *Proxy) getDNSDomain() string {
if proxy.WithoutDNS { if proxy.WithoutDNS {
return "" return ""
} }
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), Log) domain, _ := proxy.weave.DNSDomain()
domain, _ := weave.DNSDomain()
return domain return domain
} }