Пример #1
0
func cmdServer(ctx *cli.Context) {
	c, err := config.GetConfiguration(ctx)
	if err != nil {
		cli.ShowCommandHelp(ctx, "server")
		fmt.Println("Could not get configuration. Reason:", err)
		log.Fatalln("Exiting....")
	}

	if ctx.String("port") == "" {
		cli.ShowCommandHelp(ctx, "server")
		fmt.Println("Missing port")
		log.Fatalln("Exiting....")
	}

	executor := execution.NewExecutor(c.AggregateOutput, c.FailuresOnly, c.StateChangeOnly, c.ResultFormatter(), c.Writer(), c.Workers)

	asrt := NewAsrtHandler(c, executor)
	asrt.refreshServerCache()
	go asrt.loopServerCacheRefresh()

	http.Handle("/data", asrt)
	http.HandleFunc("/", serveStaticWebFiles)

	fmt.Println("Listening on port:", ctx.String("port"))
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v", ctx.String("port")), nil))
}
Пример #2
0
func cmdDashboard(ctx *cli.Context) {
	c, err := config.GetConfiguration(ctx)
	if err != nil {
		cli.ShowCommandHelp(ctx, "dashboard")
		fmt.Println("Could not get configuration. Reason:", err)
		log.Fatalln("Exiting....")
	}

	executor := execution.NewExecutor(c.AggregateOutput, c.FailuresOnly, c.StateChangeOnly, c.ResultFormatter(), c.Writer(), c.Workers)
	printDashboard(c, executor)
	loopDashboard(c, executor)
}