registry: default --insecure-registry to localhost and 127.0.0.1

Signed-off-by: Johan Euphrosine <proppy@google.com>
This commit is contained in:
Johan Euphrosine 2014-10-31 13:00:49 -07:00 committed by Erik Hollensbe
parent c00cd583e9
commit 8582d04393
2 changed files with 32 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"strings"
@ -154,7 +155,16 @@ func IsSecure(hostname string, insecureRegistries []string) bool {
if hostname == IndexServerAddress() {
return true
}
if len(insecureRegistries) == 0 {
host, _, err := net.SplitHostPort(hostname)
if err != nil {
host = hostname
}
if host == "127.0.0.1" || host == "localhost" {
return false
}
return true
}
for _, h := range insecureRegistries {
if hostname == h {
return false