From e485f47386737a99efc44c1ccd77a8ddbf159109 Mon Sep 17 00:00:00 2001 From: samlhuillier1 Date: Tue, 8 Aug 2023 23:48:03 +0000 Subject: [PATCH] choose username according to whether verb yaml --- pkg/entity/entity.go | 1 + pkg/ssh/sshconfigurer.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/entity/entity.go b/pkg/entity/entity.go index 837f1032..12102b5f 100644 --- a/pkg/entity/entity.go +++ b/pkg/entity/entity.go @@ -305,6 +305,7 @@ type Workspace struct { ExecsV1 *ExecsV1 `json:"execsV1"` IDEConfig IDEConfig `json:"ideConfig"` SSHPort int `json:"sshPort"` + VerbYaml string `json:"verbYaml"` // PrimaryApplicationId string `json:"primaryApplicationId,omitempty"` // LastOnlineAt string `json:"lastOnlineAt,omitempty"` // CreatedAt string `json:"createdAt,omitempty"` diff --git a/pkg/ssh/sshconfigurer.go b/pkg/ssh/sshconfigurer.go index aa30b0f8..0dc3089e 100644 --- a/pkg/ssh/sshconfigurer.go +++ b/pkg/ssh/sshconfigurer.go @@ -279,11 +279,17 @@ func makeSSHConfigEntryV2(workspace entity.Workspace, privateKeyPath string) (st } } else { hostname := workspace.GetHostname() + var userName string + if workspace.VerbYaml != "" { + userName = "root" + } else { + userName = "ubuntu" + } port := workspace.GetPort() entry = SSHConfigEntryV2{ Alias: alias, IdentityFile: privateKeyPath, - User: "ubuntu", // todo param-user + User: userName, // todo param-user Dir: workspace.GetProjectFolderPath(), HostName: hostname, Port: port,