Merge pull request #3089 from weaveworks/improve-flags
Improve flag handling
This commit is contained in:
2 files changed
+8
-9
No files matched your search
+8
-8
@@ -210,11 +210,7 @@ func main() {
|
|||||||
mflag.StringVar(&pluginConfig.Socket, []string{"-plugin-socket"}, "/run/docker/plugins/weave.sock", "plugin socket on which to listen")
|
mflag.StringVar(&pluginConfig.Socket, []string{"-plugin-socket"}, "/run/docker/plugins/weave.sock", "plugin socket on which to listen")
|
||||||
mflag.StringVar(&pluginConfig.MeshSocket, []string{"-plugin-mesh-socket"}, "/run/docker/plugins/weavemesh.sock", "plugin socket on which to listen in mesh mode")
|
mflag.StringVar(&pluginConfig.MeshSocket, []string{"-plugin-mesh-socket"}, "/run/docker/plugins/weavemesh.sock", "plugin socket on which to listen in mesh mode")
|
||||||
|
|
||||||
proxyConfig := configureProxy(version, defaultDockerHost)
|
proxyConfig := newProxyConfig()
|
||||||
if bridgeConfig.AWSVPC {
|
|
||||||
proxyConfig.NoMulticastRoute = true
|
|
||||||
proxyConfig.KeepTXOn = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// crude way of detecting that we probably have been started in a
|
// crude way of detecting that we probably have been started in a
|
||||||
// container, with `weave launch` --> suppress misleading paths in
|
// container, with `weave launch` --> suppress misleading paths in
|
||||||
@@ -231,6 +227,12 @@ func main() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proxyConfig.DockerHost = dockerAPI
|
||||||
|
if bridgeConfig.AWSVPC {
|
||||||
|
proxyConfig.NoMulticastRoute = true
|
||||||
|
proxyConfig.KeepTXOn = true
|
||||||
|
}
|
||||||
|
|
||||||
peers = mflag.Args()
|
peers = mflag.Args()
|
||||||
if resume && len(peers) > 0 {
|
if resume && len(peers) > 0 {
|
||||||
Log.Fatalf("You must not specify an initial peer list in conjunction with --resume")
|
Log.Fatalf("You must not specify an initial peer list in conjunction with --resume")
|
||||||
@@ -525,12 +527,10 @@ func (nopPacketLogging) LogPacket(string, weave.PacketKey) {
|
|||||||
func (nopPacketLogging) LogForwardPacket(string, weave.ForwardPacketKey) {
|
func (nopPacketLogging) LogForwardPacket(string, weave.ForwardPacketKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureProxy(version string, defaultDockerHost string) *weaveproxy.Config {
|
func newProxyConfig() *weaveproxy.Config {
|
||||||
proxyConfig := weaveproxy.Config{
|
proxyConfig := weaveproxy.Config{
|
||||||
Version: version,
|
|
||||||
Image: getenvOrDefault("EXEC_IMAGE", "weaveworks/weaveexec"),
|
Image: getenvOrDefault("EXEC_IMAGE", "weaveworks/weaveexec"),
|
||||||
DockerBridge: getenvOrDefault("DOCKER_BRIDGE", "docker0"),
|
DockerBridge: getenvOrDefault("DOCKER_BRIDGE", "docker0"),
|
||||||
DockerHost: defaultDockerHost,
|
|
||||||
}
|
}
|
||||||
mflag.BoolVar(&proxyConfig.Enabled, []string{"-proxy"}, false, "instruct Weave Net to start its Docker proxy")
|
mflag.BoolVar(&proxyConfig.Enabled, []string{"-proxy"}, false, "instruct Weave Net to start its Docker proxy")
|
||||||
mflagext.ListVar(&proxyConfig.ListenAddrs, []string{"H"}, nil, "addresses on which to listen for Docker proxy")
|
mflagext.ListVar(&proxyConfig.ListenAddrs, []string{"H"}, nil, "addresses on which to listen for Docker proxy")
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ type Config struct {
|
|||||||
NoDefaultIPAM bool
|
NoDefaultIPAM bool
|
||||||
NoRewriteHosts bool
|
NoRewriteHosts bool
|
||||||
TLSConfig TLSConfig
|
TLSConfig TLSConfig
|
||||||
Version string
|
|
||||||
WithoutDNS bool
|
WithoutDNS bool
|
||||||
NoMulticastRoute bool
|
NoMulticastRoute bool
|
||||||
KeepTXOn bool
|
KeepTXOn bool
|
||||||
|
|||||||
Reference in new issue
Block a user