Skip to content

Commit 3088cb5

Browse files
authored
Render console URL in service describe output (#44)
1 parent 07874d5 commit 3088cb5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/tiger/cmd/service.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ type OutputService struct {
605605
api.Service
606606
password.ConnectionDetails
607607
ConnectionString string `json:"connection_string,omitempty" yaml:"connection_string,omitempty"`
608+
ConsoleURL string `json:"console_url,omitempty" yaml:"console_url,omitempty"`
608609
}
609610

610611
// Convert to JSON to respect omitempty tags, then unmarshal
@@ -769,6 +770,9 @@ func outputServiceTable(service OutputService, output io.Writer) error {
769770
if service.ConnectionString != "" {
770771
table.Append("Connection String", service.ConnectionString)
771772
}
773+
if service.ConsoleURL != "" {
774+
table.Append("Console URL", service.ConsoleURL)
775+
}
772776

773777
return table.Render()
774778
}
@@ -821,6 +825,13 @@ func prepareServiceForOutput(service api.Service, withPassword bool, output io.W
821825
outputSvc.ConnectionString = connectionDetails.String()
822826
}
823827

828+
// Build console URL
829+
cfg, err := config.Load()
830+
if err == nil {
831+
url := fmt.Sprintf("%s/dashboard/services/%s", cfg.ConsoleURL, *service.ServiceId)
832+
outputSvc.ConsoleURL = url
833+
}
834+
824835
return outputSvc
825836
}
826837

0 commit comments

Comments
 (0)