Skip to content

Commit

Permalink
Update connection scheme based on SSL flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Codycody31 committed Feb 2, 2024
1 parent 0c15d1d commit 3331140
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ func connectToServer(agent *Agent, log Logger, context *cli.Context) bool {
u = url.URL{Scheme: "wss", Host: context.String("server"), Path: "/api/ws"}
}

// Schema for the server if SSL is enabled
if context.Bool("ssl") {
u.Scheme = "wss"
} else {
u.Scheme = "ws"
}

fmt.Println("Scheme: " + u.Scheme)

fmt.Println("Connecting to server: " + u.String())

c, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
Expand Down

0 comments on commit 3331140

Please sign in to comment.