Skip to content

Commit

Permalink
add more agent logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 16, 2024
1 parent 7ddd5e4 commit d6d5233
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/ctrlc/root/agent/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,27 @@ func NewAgentRunCmd() *cobra.Command {
Short: "Run the agent",
Long: `Run the agent to establish connection with the proxy.`,
RunE: func(cmd *cobra.Command, args []string) error {
agentName = strings.Trim(agentName, "\"")
workspace = strings.Trim(workspace, "\"")

proxyAddr := viper.GetString("url")
proxyAddr = strings.TrimPrefix(proxyAddr, "https://")
proxyAddr = strings.TrimPrefix(proxyAddr, "http://")

if insecure {
proxyAddr = "ws://" + proxyAddr
} else {
proxyAddr = "wss://" + proxyAddr
}

log.Printf("Starting agent %q in workspace %q", agentName, workspace)
log.Printf("Connecting to proxy at %s", proxyAddr)
if len(metadata) > 0 {
log.Printf("With metadata: %v", metadata)
}
if len(associatedResources) > 0 {
log.Printf("Associated with resources: %v", associatedResources)
}

apiKey := viper.GetString("api-key")
agent := agent.NewAgent(
proxyAddr,
Expand Down

0 comments on commit d6d5233

Please sign in to comment.