main.go 844 字节
Newer Older
Y
Your Name 已提交
1 2 3 4
package main

import (
	"flag"
Y
Your Name 已提交
5
	"github.com/eolinker/goku-api-gateway/admin/node"
Y
Your Name 已提交
6 7 8 9 10 11 12 13 14
	"github.com/eolinker/goku-api-gateway/config"
	log "github.com/eolinker/goku-api-gateway/goku-log"
	"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
		console := node.NewConsole(admin,instance)

Y
Your Name 已提交
25 26
		ser := server.NewServer()
		log.Fatal(ser.ServerWidthConsole(console))
Y
Your Name 已提交
27 28 29
		return
	}

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

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

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