server.go 1.5 KB
Newer Older
Y
Your Name 已提交
1
package gokunode
E
eoLinker API Management 已提交
2 3

import (
黄孟柱 已提交
4 5 6 7 8
	log "github.com/eolinker/goku-api-gateway/goku-log"
	config_manager "github.com/eolinker/goku-api-gateway/goku-node/manager/config-manager"
	"github.com/eolinker/goku-api-gateway/goku-node/manager/updater"
	node_common "github.com/eolinker/goku-api-gateway/goku-node/node-common"
	monitor_write "github.com/eolinker/goku-api-gateway/server/monitor/monitor-write"
E
eoLinker API Management 已提交
9 10

	goku_plugin "github.com/eolinker/goku-plugin"
黄孟柱 已提交
11
	redis_plugin_proxy "github.com/eolinker/goku-api-gateway/goku-node/redis-plugin-proxy"
E
eoLinker API Management 已提交
12

黄孟柱 已提交
13
	"github.com/eolinker/goku-api-gateway/goku-service/discovery"
E
eoLinker API Management 已提交
14 15 16
	"strings"
)

Y
Your Name 已提交
17
//InitPluginUtils 初始化插件工具
E
eoLinker API Management 已提交
18 19 20 21 22
func InitPluginUtils() {
	goku_plugin.SetRedisManager(redis_plugin_proxy.Create())
	goku_plugin.InitLog(log.GetLogger())
	//goku_plugin.SetLog(new(log_plugin_proxy.LoggerGeneral))
}
Y
Your Name 已提交
23 24

//InitDiscovery 初始化服务发现
E
eoLinker API Management 已提交
25 26 27 28 29
func InitDiscovery() {

	all := discovery.AllDrivers()
	log.Infof("install service discovery driver:[%s]\n", strings.Join(all, ","))
}
Y
Your Name 已提交
30 31

//InitLog 初始化日志模块
Y
Your Name 已提交
32
func InitLog() {
E
eoLinker API Management 已提交
33 34
	config_manager.InitLog()
}
Y
Your Name 已提交
35 36

//InitServer 初始化Server
Y
Your Name 已提交
37
func InitServer() {
E
eoLinker API Management 已提交
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
	log.Debug("init InitServer start")

	InitPluginUtils()

	log.Debug("init InitPluginUtils done")
	InitDiscovery()
	log.Debug("init InitDiscovery done")
	// 注册自动更新,并保证第一次全量拉取完数据
	updater.InitUpdate()

	//// 执行插件初始化函数
	// 插件初始化放在 plugin-manager中
	log.Debug("init updater.InitUpdate done")

	monitor_write.InitMonitorWrite(node_common.ClusterName())
	log.Debug("init server done")
}