Merge branch '573-add_host_port-feature'

This commit is contained in:
Guillaume J. Charmes 2013-05-24 11:36:05 -07:00
commit 48fd8ae79c
2 changed files with 9 additions and 5 deletions

View File

@ -56,7 +56,7 @@ func TestGetAuth(t *testing.T) {
t.Fatalf("%d OK or 0 expected, received %d\n", http.StatusOK, r.Code) t.Fatalf("%d OK or 0 expected, received %d\n", http.StatusOK, r.Code)
} }
newAuthConfig := srv.registry.GetAuthConfig() newAuthConfig := srv.registry.GetAuthConfig(false)
if newAuthConfig.Username != authConfig.Username || if newAuthConfig.Username != authConfig.Username ||
newAuthConfig.Email != authConfig.Email { newAuthConfig.Email != authConfig.Email {
t.Fatalf("The auth configuration hasn't been set correctly") t.Fatalf("The auth configuration hasn't been set correctly")

View File

@ -24,8 +24,8 @@ func main() {
docker.SysInit() docker.SysInit()
return return
} }
host:= "127.0.0.1" host := "127.0.0.1"
port:= 4243 port := 4243
// FIXME: Switch d and D ? (to be more sshd like) // FIXME: Switch d and D ? (to be more sshd like)
flDaemon := flag.Bool("d", false, "Daemon mode") flDaemon := flag.Bool("d", false, "Daemon mode")
flDebug := flag.Bool("D", false, "Debug mode") flDebug := flag.Bool("D", false, "Debug mode")
@ -40,15 +40,19 @@ func main() {
docker.NetworkBridgeIface = docker.DefaultNetworkBridge docker.NetworkBridgeIface = docker.DefaultNetworkBridge
} }
if strings.Contains(*flHost, ":") && len(strings.Split(*flHost, ":")) == 2 { if strings.Contains(*flHost, ":") {
hostParts := strings.Split(*flHost, ":") hostParts := strings.Split(*flHost, ":")
if len(hostParts) != 2 {
log.Fatal("Invalid bind address format.")
os.Exit(-1)
}
if hostParts[0] != "" { if hostParts[0] != "" {
host = hostParts[0] host = hostParts[0]
} }
if p, err := strconv.Atoi(hostParts[1]); err == nil { if p, err := strconv.Atoi(hostParts[1]); err == nil {
port = p port = p
} }
} else if !strings.Contains(*flHost, ":") { } else {
host = *flHost host = *flHost
} }