Ejemplo n.º 1
0
// link worker code.
func linkCode() bool {
	configFile := os.Getenv("GOPATH") + "/src/git.masontest.com/branches/goserver/config.yml" // 默认配置文件在当前运行命令目录下的config.yml
	env := "dev"

	// 获取配置信息.
	mainConfig, serviceConfig := config.GetConfig(configFile, env)

	// log
	log := plugins.NewServerLog("")

	appNames := []string{}
	for sn, config := range serviceConfig {
		if config["handle_path"] != "" {
			appNames = append(appNames, sn)
		}
	}

	r.BuildAppLink(appNames)

	if len(appNames) == 0 {
		return false
	}

	for sn, config := range serviceConfig {
		// to link apps code to runtime
		r.Build(mainConfig["env"], sn, config["handle_path"], log)
	}

	return true
}
Ejemplo n.º 2
0
func Test_Build(t *testing.T) {
	logger := plugins.NewServerLog("test")

	_, serviceConfig := config.GetConfig("../../config.yml", "dev")

	for appName, config := range serviceConfig {
		r.Build(appName, config["handle_path"], logger)
	}
}