package main

import (
	"flag"
	"fmt"
	"wdd.io/agent-go/g"
	logger2 "wdd.io/agent-go/logger"
	"wdd.io/agent-go/register"
)

var log = logger2.Log

func main() {

	// 解析命令行参数
	var version string
	var agentServerInfoConf string
	flag.StringVar(&version, "version", "", "config file version")
	flag.StringVar(&agentServerInfoConf, "agentServerInfoConf", "", "agent server info conf file")
	flag.Parse()
	// 读取对应版本的配置文件
	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)

	// 执行初始化之策工作
	businessForeverChan := INIT(agentServerInfoConf)

	// 永远等待 runtime的队列消息
	<-businessForeverChan

}
