Exemplo n.º 1
0
Arquivo: main.go Projeto: myhung/query
func main() {
	cfg := flag.String("c", "cfg.json", "specify config file")
	version := flag.Bool("v", false, "show version")
	versionGit := flag.Bool("vg", false, "show version and git commit log")
	flag.Parse()

	if *version {
		fmt.Println(g.VERSION)
		os.Exit(0)
	}
	if *versionGit {
		fmt.Println(g.VERSION, g.COMMIT)
		os.Exit(0)
	}

	// config
	g.ParseConfig(*cfg)
	// proc
	proc.Start()

	// graph
	graph.Start()

	// http
	http.Start()

	select {}
}
Exemplo n.º 2
0
Arquivo: main.go Projeto: donh/query
func main() {
	cfg := flag.String("c", "cfg.json", "specify config file")
	version := flag.Bool("v", false, "show version")
	versionGit := flag.Bool("vg", false, "show version and git commit log")
	flag.Parse()

	if *version {
		fmt.Println(g.VERSION)
		os.Exit(0)
	}
	if *versionGit {
		fmt.Println(g.VERSION, g.COMMIT)
		os.Exit(0)
	}

	// config
	g.ParseConfig(*cfg)
	gconf := g.Config()
	// proc
	proc.Start()

	// graph
	graph.Start()

	grpcMsg := make(chan string)
	if gconf.Grpc.Enabled {
		// grpc
		go grpc.Start(grpcMsg)
	}

	ginMsg := make(chan string)

	if gconf.GinHttp.Enabled {
		//lambdaSetup
		database.Init()
		conf.ReadConf("./conf/lambdaSetup.json")
		go ginHttp.StartWeb(ginMsg)
	}

	httpMsg := make(chan string)

	if gconf.Http.Enabled {
		// http
		go http.Start(httpMsg)
	}

	select {
	case <-grpcMsg:
		log.Printf("%v is crashed", grpcMsg)
	case <-ginMsg:
		log.Printf("%v is crashed", ginMsg)
	case <-httpMsg:
		log.Printf("%v is crashed", ginMsg)
	}
}