Skip to content

Commit

Permalink
add header logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 16, 2024
1 parent d6d5233 commit c2e89dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 0 additions & 3 deletions cmd/ctrlc/root/agent/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ 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://")
Expand Down
9 changes: 9 additions & 0 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ func NewAgent(serverURL, agentName string, opts ...func(*Agent)) *Agent {
for _, opt := range opts {
opt(agent)
}

// Print agent headers for debugging
for key, values := range agent.headers {
if key != "X-Api-Key" {
for _, value := range values {
log.Printf("Header %s: %s", key, value)
}
}
}
return agent
}

Expand Down

0 comments on commit c2e89dd

Please sign in to comment.