[ Cmii ] [ Octopus ] - reformat agent-go - 1
This commit is contained in:
@@ -4,8 +4,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"wdd.io/agent-common/logger"
|
||||
"wdd.io/agent-go/g"
|
||||
"wdd.io/agent-go/register"
|
||||
"wdd.io/agent-go/a_init"
|
||||
)
|
||||
|
||||
var log = logger.Log
|
||||
@@ -14,26 +13,25 @@ func main() {
|
||||
|
||||
// 解析命令行参数
|
||||
var version string
|
||||
var agentServerInfoConf string
|
||||
var agentServerInfoConfFile string
|
||||
var mode string
|
||||
flag.StringVar(&version, "version", "", "config file version")
|
||||
flag.StringVar(&mode, "mode", "agent", "agent run mode")
|
||||
flag.StringVar(&agentServerInfoConf, "agentServerInfoConf", "", "agent server info conf file")
|
||||
flag.StringVar(&agentServerInfoConfFile, "agentServerInfoConfFile", "", "agent server info conf file")
|
||||
flag.Parse()
|
||||
|
||||
if mode == "bastion" {
|
||||
BastionModeInit()
|
||||
return
|
||||
}
|
||||
// 读取对应版本的配置文件
|
||||
filename := fmt.Sprintf("octopus-agent-%s.yaml", version)
|
||||
println("config file name is => " + filename)
|
||||
println("agent server info file is => " + agentServerInfoConf)
|
||||
|
||||
// 初始化Nacos的连接配置
|
||||
g.G.AgentConfig = register.ParseConfiguration(filename)
|
||||
// 读取对应版本的配置文件
|
||||
octopusAgentConfigFileName := fmt.Sprintf("octopus-agent-%s.yaml", version)
|
||||
fmt.Println("config file name is => " + octopusAgentConfigFileName)
|
||||
fmt.Println("agent server info file is => " + agentServerInfoConfFile)
|
||||
|
||||
// 执行初始化之策工作
|
||||
businessForeverChan := INIT(agentServerInfoConf)
|
||||
businessForeverChan := a_init.INIT(octopusAgentConfigFileName, agentServerInfoConfFile)
|
||||
|
||||
// 永远等待 runtime的队列消息
|
||||
<-businessForeverChan
|
||||
|
||||
Reference in New Issue
Block a user