[proxy] refactor weaveCIDRsFromConfig slightly
This commit is contained in:
1 parent
ca681bce13
commit
6c26a55b5a
5 files changed
+16
-16
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/fsouza/go-dockerclient"
|
||||
. "github.com/weaveworks/weave/common"
|
||||
@@ -113,3 +114,15 @@ func (proxy *Proxy) ListenAndServe() error {
|
||||
|
||||
return (&http.Server{Handler: proxy}).Serve(listener)
|
||||
}
|
||||
|
||||
func (proxy *Proxy) weaveCIDRsFromConfig(config *docker.Config) ([]string, bool) {
|
||||
for _, e := range config.Env {
|
||||
if strings.HasPrefix(e, "WEAVE_CIDR=") {
|
||||
if e[11:] == "none" {
|
||||
return nil, false
|
||||
}
|
||||
return strings.Fields(e[11:]), true
|
||||
}
|
||||
}
|
||||
return nil, !proxy.NoDefaultIPAM
|
||||
}
|
||||
Reference in new issue
Block a user