tiny refactor: raise abstraction level
This commit is contained in:
1 parent
7780ac1078
commit
657bbbffbc
1 file changed
+2
-3
@@ -56,7 +56,7 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
if err := i.setWeaveWaitEntrypoint(container.Config); err != nil {
|
if err := i.setWeaveWaitEntrypoint(container.Config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := i.setWeaveDNS(&container, r); err != nil {
|
if err := i.setWeaveDNS(&container, r.URL.Query().Get("name")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ func (i *createContainerInterceptor) setWeaveWaitEntrypoint(container *docker.Co
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *createContainerInterceptor) setWeaveDNS(container *createContainerRequestBody, r *http.Request) error {
|
func (i *createContainerInterceptor) setWeaveDNS(container *createContainerRequestBody, name string) error {
|
||||||
if i.proxy.WithoutDNS {
|
if i.proxy.WithoutDNS {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,6 @@ func (i *createContainerInterceptor) setWeaveDNS(container *createContainerReque
|
|||||||
|
|
||||||
container.HostConfig.DNS = append(container.HostConfig.DNS, i.proxy.dockerBridgeIP)
|
container.HostConfig.DNS = append(container.HostConfig.DNS, i.proxy.dockerBridgeIP)
|
||||||
|
|
||||||
name := r.URL.Query().Get("name")
|
|
||||||
if container.Hostname == "" && name != "" {
|
if container.Hostname == "" && name != "" {
|
||||||
container.Hostname = name
|
container.Hostname = name
|
||||||
// Strip trailing period because it's unusual to see it used on the end of a host name
|
// Strip trailing period because it's unusual to see it used on the end of a host name
|
||||||
|
|||||||
Reference in new issue
Block a user