Skip to content

Commit b778417

Browse files
authored
Entirely Internal Connection (#1610)
This change allows the user to specify all connection details in an internal connection rather than forcing them to rely on the ssh config for certain keywords.
1 parent dbacae8 commit b778417

File tree

5 files changed

+155
-107
lines changed

5 files changed

+155
-107
lines changed

frontend/types/gotypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ declare global {
290290
type ConnKeywords = {
291291
"conn:wshenabled"?: boolean;
292292
"conn:askbeforewshinstall"?: boolean;
293+
"conn:overrideconfig"?: boolean;
293294
"display:hidden"?: boolean;
294295
"display:order"?: number;
295296
"term:*"?: boolean;

pkg/remote/connutil.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"os/user"
1414
"path/filepath"
1515
"regexp"
16-
"strconv"
1716
"strings"
1817

1918
"github.com/wavetermdev/waveterm/pkg/panichandler"
@@ -27,16 +26,8 @@ func ParseOpts(input string) (*SSHOpts, error) {
2726
if m == nil {
2827
return nil, fmt.Errorf("invalid format of user@host argument")
2928
}
30-
remoteUser, remoteHost, remotePortStr := m[1], m[2], m[3]
29+
remoteUser, remoteHost, remotePort := m[1], m[2], m[3]
3130
remoteUser = strings.Trim(remoteUser, "@")
32-
var remotePort int
33-
if remotePortStr != "" {
34-
var err error
35-
remotePort, err = strconv.Atoi(remotePortStr)
36-
if err != nil {
37-
return nil, fmt.Errorf("invalid port specified on user@host argument")
38-
}
39-
}
4031

4132
return &SSHOpts{SSHHost: remoteHost, SSHUser: remoteUser, SSHPort: remotePort}, nil
4233
}
@@ -341,7 +332,7 @@ func IsPowershell(shellPath string) bool {
341332

342333
func NormalizeConfigPattern(pattern string) string {
343334
userName, err := WaveSshConfigUserSettings().GetStrict(pattern, "User")
344-
if err != nil {
335+
if err != nil || userName == "" {
345336
log.Printf("warning: error parsing username of %s for conn dropdown: %v", pattern, err)
346337
localUser, err := user.Current()
347338
if err == nil {

0 commit comments

Comments
 (0)