main.go 859 字节
Newer Older
Y
Your Name 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package main

import (
	"flag"
	"github.com/eolinker/goku-api-gateway/config"
	log "github.com/eolinker/goku-api-gateway/goku-log"
	console2 "github.com/eolinker/goku-api-gateway/node/console"
	"github.com/eolinker/goku-api-gateway/node/server"
	"runtime"
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

Y
Your Name 已提交
15
	instance, admin, staticConfigFile, isDebug := ParseFlag()
Y
Your Name 已提交
16 17 18 19 20

	if isDebug {
		log.StartDebug()
	}

Y
Your Name 已提交
21
	if admin != "" && instance != ""{
Y
Your Name 已提交
22

Y
Your Name 已提交
23 24 25
		console := console2.NewConsole(instance, admin)
		ser := server.NewServer()
		log.Fatal(ser.ServerWidthConsole(console))
Y
Your Name 已提交
26 27 28
		return
	}

Y
Your Name 已提交
29
 	if staticConfigFile != "" {
Y
Your Name 已提交
30 31 32 33 34 35

		// 从静态文件启动
		c, err := config.ReadConfig(staticConfigFile)
		if err != nil {
			log.Panic("read config from :", staticConfigFile, "\t", err)
		}
Y
Your Name 已提交
36 37
		ser := server.NewServer()
		log.Fatal(ser.ServerWidthConfig(c))
Y
Your Name 已提交
38
	}
Y
Your Name 已提交
39 40

	flag.Usage()
Y
Your Name 已提交
41
}