Files
ProjectOctopus/agent-go/main.go
2024-04-19 16:50:56 +08:00

42 lines
1.0 KiB
Go

package main
import (
"flag"
"fmt"
"wdd.io/agent-common/logger"
"wdd.io/agent-go/a_init"
)
var log = logger.Log
func main() {
// 解析命令行参数
var version string
var agentServerInfoConfFile string
var mode string
flag.StringVar(&version, "version", "", "config file version")
flag.StringVar(&mode, "mode", "agent", "agent run mode")
flag.StringVar(&agentServerInfoConfFile, "agentServerInfoConfFile", "", "agent server info conf file")
flag.Parse()
if mode == "bastion" {
// 堡垒机模式
// 初始化堡垒机模式
a_init.BastionModeInit()
return
}
// 读取对应版本的配置文件
octopusAgentConfigFileName := fmt.Sprintf("octopus-agent-%s.yaml", version)
fmt.Println("config file name is => " + octopusAgentConfigFileName)
fmt.Println("agent server info file is => " + agentServerInfoConfFile)
// 执行初始化之策工作
businessForeverChan := a_init.INIT(octopusAgentConfigFileName, agentServerInfoConfFile)
// 永远等待 runtime的队列消息
<-businessForeverChan
}