Пример #1
0
func runServer(c *cli.Context) {
	if !util.FileExist(configFile) {
		fmt.Println("The config file(" + configFile + ") is not exist!")
		return
	}

	srvr, err := osinstallserver.NewServer(configFile, osinstallserver.DevPipeline)
	if err != nil {
		srvr.Log.Error(err)
		return
	}

	addr := ":8083"

	l4, err := net.Listen("tcp4", addr)
	if err != nil {
		srvr.Log.Error(err)
		return
	}

	srvr.Log.Info("The server is running.")

	//cron
	route.CloudBootCron(srvr.Conf, srvr.Log, srvr.Repo)

	if err := http.Serve(l4, srvr); err != nil {
		srvr.Log.Error(err)
		return
	}
}
Пример #2
0
func main() {
	srvr, err := osinstallserver.NewServer("idcos-os-install.json", osinstallserver.DevPipeline)
	if err != nil {
		fmt.Println(err)
		return
	}

	addr := ":8083"

	l4, err := net.Listen("tcp4", addr)
	if err != nil {
		fmt.Println(err)
		return
	}

	if err := http.Serve(l4, srvr); err != nil {
		fmt.Println(err)
		return
	}
}