feat: 添加 InitialAuthToken 方法以优先使用 AgentToken,更新主函数以使用新方法

This commit is contained in:
ryan
2026-03-10 23:34:04 +08:00
parent 096aa17157
commit f3f4980b7d
3 changed files with 54 additions and 1 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ func main() {
)
log.Printf("agent config loaded: server=%s node=%s ip=%s heartbeat_interval=%s sync_interval=%s route_config=%s cert_dir=%s", cfg.ServerURL, cfg.NodeName, cfg.NodeIP, cfg.HeartbeatInterval, cfg.SyncInterval, cfg.RouteConfigPath, cfg.CertDir)
client := httpclient.New(cfg.ServerURL, cfg.AgentToken, cfg.RequestTimeout.Duration())
client := httpclient.New(cfg.ServerURL, cfg.InitialAuthToken(), cfg.RequestTimeout.Duration())
stateStore := state.NewStore(cfg.StatePath)
runner := &agent.Runner{
Config: cfg,