func runNginxServer() { routes := makeRouteMap(docker.ListContainers()) // Use nginx to forward file, err := os.Create(*nginxFile) if err != nil { log.Fatal("Couldn't open nginx file: ", err) } nginx.WriteConfigFile(file, routes, nginx.Config{ServerName: "localhost"}) if getNginxStatus() { cmd := nginx.StopCommand() err := cmd.Run() if err != nil { log.Fatal("Couldn't stop nginx: ", err) } } cmd := nginx.StartCommand(*nginxFile) err = cmd.Run() if err != nil { log.Fatal("Couldn't start nginx: ", err) } }
func runSeaportServer(port int) { routes := makeRouteMap(docker.ListContainers()) listener, err := net.Listen("tcp", ":"+strconv.Itoa(port)) if err != nil { log.Fatal(err) } s := seaport.Seaport{routes, listener} s.Listen() }