From 4190e7e6ebc50a8c642a680c39d7d3855c41c7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Er=C3=A8be=20-=20Romain=20Gerard?= Date: Thu, 28 Dec 2023 14:57:36 +0100 Subject: [PATCH] feat(port-forward): Add support for managed database (#233) --- cmd/port-forward.go | 7 +++++-- pkg/port-forward.go | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/port-forward.go b/cmd/port-forward.go index 1a18518d..edf06126 100644 --- a/cmd/port-forward.go +++ b/cmd/port-forward.go @@ -145,6 +145,7 @@ func portForwardRequestFromSelect() (*pkg.PortForwardRequest, error) { return &pkg.PortForwardRequest{ ServiceID: service.ID, + ServiceType: strings.ToUpper(string(service.Type)), ProjectID: project.ID, OrganizationID: orga.ID, EnvironmentID: env.ID, @@ -175,6 +176,7 @@ func portForwardRequestFromContext(currentContext utils.QoveryContext) (*pkg.Por return &pkg.PortForwardRequest{ ServiceID: currentContext.ServiceId, + ServiceType: strings.ToUpper(string(currentContext.ServiceType)), ProjectID: currentContext.ProjectId, OrganizationID: currentContext.OrganizationId, EnvironmentID: currentContext.EnvironmentId, @@ -290,10 +292,11 @@ func portForwardRequestWithApplicationUrl(args []string) (*pkg.PortForwardReques ProjectID: project.ID, EnvironmentID: environment.ID, ServiceID: service.ID, + ServiceType: strings.ToUpper(string(service.Type)), ClusterID: environment.ClusterID, PodName: podName, - Port: 8000, - LocalPort: 8000, + Port: 0, + LocalPort: 0, }, nil } diff --git a/pkg/port-forward.go b/pkg/port-forward.go index 0309bfad..20755a06 100644 --- a/pkg/port-forward.go +++ b/pkg/port-forward.go @@ -4,15 +4,14 @@ import ( "errors" "fmt" "github.com/appscode/go-querystring/query" + "github.com/gorilla/websocket" + "github.com/qovery/qovery-cli/utils" + log "github.com/sirupsen/logrus" "io" "net" "net/http" "net/url" "regexp" - - "github.com/gorilla/websocket" - "github.com/qovery/qovery-cli/utils" - log "github.com/sirupsen/logrus" ) type PortForwardRequest struct { @@ -22,6 +21,7 @@ type PortForwardRequest struct { OrganizationID utils.Id `url:"organization"` ClusterID utils.Id `url:"cluster"` PodName string `url:"pod_name,omitempty"` + ServiceType string `url:"service_type"` Port uint16 `url:"port"` LocalPort uint16 }