Skip to content

Commit

Permalink
fix: endpoint ID hardcoded in WS URL
Browse files Browse the repository at this point in the history
  • Loading branch information
devbranch-vadym committed Oct 28, 2022
1 parent b3fc19e commit 53dbfd5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/portainer/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ func (r *API) GetExecSessionExitCode(execInstanceId string) (int, error) {
return int(resp["ExitCode"].(float64)), nil
}

func (r *API) getWsUrl(execInstanceId string) string {
func (r *API) getWsUrl(execInstanceId string, endpointId int) string {
jwt, _ := r.getJwt()
return r.formatWsApiUrl() + "/websocket/exec?token=" + jwt + "&endpointId=1&id=" + execInstanceId
return r.formatWsApiUrl() + "/websocket/exec?token=" + jwt + "&endpointId=" + strconv.Itoa(endpointId) + "&id=" + execInstanceId
}

func (r *API) getWSConn(wsUrl string) *websocket.Conn {
Expand All @@ -227,7 +227,7 @@ func (r *API) GetContainerConn(params *ContainerExecParams) ShellSession {
os.Exit(1)
}

wsurl := r.getWsUrl(execInstanceId)
wsurl := r.getWsUrl(execInstanceId, r.Endpoint)
resize, _, _ := r.handleTerminalResize(execInstanceId)

fmt.Println("Connecting to a shell ...")
Expand Down

0 comments on commit 53dbfd5

Please sign in to comment.