Skip to content

Commit 17a1a51

Browse files
author
Mehrad
committed
print user:pass @ SFTP.portforward
1 parent 1812ebc commit 17a1a51

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

cmd/command_link.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func init() {
104104
setLinkCmd.Flags().StringP("path", "p", "", "http subpath to route traffic")
105105

106106
// srv/app </- Domain
107-
setLinkCmd.Flags().StringP("endpoint", "e", "", "name of the service endpoint")
107+
setLinkCmd.Flags().StringP("endpoint", "e", "", "name of the service or applications endpoint")
108108
unsetLinkCmd.Flags().StringP("path", "p", "", "http subpath to route traffic")
109109

110110
// unset:

cmd/service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ func srvInfo(cmd *cobra.Command, args []string) {
2626
}
2727

2828
func srvPortforward(cmd *cobra.Command, args []string) {
29+
srvName := getCliRequiredArg(args, 0)
2930
req := getCliRequestIdentity(args, 0)
3031
client := grpcConnect()
3132
defer client.Close()
3233
info, err := client.V2().SrvInfo(client.Context(), req)
3334
res, err := client.V2().SrvPortforward(client.Context(), req)
3435
uiCheckErr("Could not Portforward the Service", err)
3536
uiServicStatus(info)
36-
uiPortforward(res)
37+
uiPortforward(srvName, nil, res)
3738
}
3839

3940
// ServiceStart start service by name

cmd/ui.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func uiServicStatus(srv *ybApi.SrvStatusRes) {
155155
printKeyVal(whiteSpace, "Updated", toTime(srv.Updated))
156156
}
157157

158-
func uiPortforward(in *ybApi.PortforwardRes) {
158+
func uiPortforward(srvName string, extraVar map[string]string, in *ybApi.PortforwardRes) {
159159
bearer := string(in.Token)
160160
localPorts := []string{}
161161
for _, p := range in.Ports {
@@ -193,21 +193,25 @@ func uiPortforward(in *ybApi.PortforwardRes) {
193193
colorfulPrintln(whiteSpace)
194194
colorfulPrintln(whiteSpace, mainTxtSprint(" Now local ports are accessible from localhost: "))
195195
for _, p := range localPorts {
196-
fports := strings.Split(p, ":")
197196
colorfulPrint(whiteSpace)
197+
fports := strings.Split(p, ":")
198198
fmt.Printf("%s%s%s%s\r\n",
199199
mainTxtColor(" Forwarding from "),
200200
secTxtColor(" 127.0.0.1:%s ", fports[0]),
201201
mainTxtBlink(" ~> "),
202-
secTxtColor(" %s ", fports[1]))
202+
secTxtColor(" %s:%s ", srvName, fports[1]))
203+
}
204+
205+
for k, v := range extraVar {
206+
printKeyVal(whiteSpace, k, v)
203207
}
204208

205209
<-signals
206210
fmt.Print(secTitleColor(" Closing ports... "))
207211
if done != nil {
208212
close(done)
209213
}
210-
fmt.Println(secTitleBlink(" done "))
214+
fmt.Println(secTitleColor(" done "))
211215
os.Exit(1)
212216

213217
}()

cmd/volume.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"log"
5+
56
"github.com/spf13/cobra"
67
ybApi "github.com/yottab/proto-api/proto"
78
)
@@ -42,13 +43,16 @@ func volumeInfo(cmd *cobra.Command, args []string) {
4243
uiCheckErr("Could not get the Volumes", err)
4344
uiVolumeStatus(res)
4445
}
46+
4547
func volumeSftp(cmd *cobra.Command, args []string) {
48+
volumeName := getCliRequiredArg(args, 0)
49+
volumeUserPass := map[string]string{" User": "root", " Password": "root"}
4650
req := getCliRequestIdentity(args, 0)
4751
client := grpcConnect()
4852
defer client.Close()
4953
res, err := client.V2().VolumeFTPPortforward(client.Context(), req)
5054
uiCheckErr("Could not Portforward the Service", err)
51-
uiPortforward(res)
55+
uiPortforward(volumeName, volumeUserPass, res)
5256
}
5357

5458
// VolumeCreate crate a volume by name and type

0 commit comments

Comments
 (0)