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 main() { // Configure the logger log.SetLevel(logLevel) // Parse the input kingpin.Parse() if *seaportMode { runSeaportServer(*serverPort) } else if *stop { cmd := nginx.StopCommand() err := cmd.Run() if err != nil { log.Fatal(err) } } else { runNginxServer() } }