Skip to content

Commit 8d077b6

Browse files
felladrinroboquat
authored andcommitted
Expose a new environment variable JETBRAINS_GITPOD_WORKSPACE_HOST to be displayed on JB IDE Hostname widget
1 parent 236f31e commit 8d077b6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodGatewayClientCustomizationProvider.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import javax.swing.Icon
1313

1414
class GitpodGatewayClientCustomizationProvider : GatewayClientCustomizationProvider {
1515
override val icon: Icon = GitpodIcons.Logo
16-
override val title: String = DefaultGatewayControlCenterProvider().getHostnameShort()
16+
override val title: String = System.getenv("JETBRAINS_GITPOD_WORKSPACE_HOST") ?: DefaultGatewayControlCenterProvider().getHostnameShort()
1717

1818
override val controlCenter: GatewayControlCenterProvider = object : GatewayControlCenterProvider {
1919
override fun getHostnameDisplayKind() = GatewayHostnameDisplayKind.ShowHostnameOnNavbar
2020
override fun getHostnameShort() = title
2121
override fun getHostnameLong() = title
2222
}
2323
}
24-

components/ide/jetbrains/image/status/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ func run(wsInfo *supervisor.WorkspaceInfoResponse) {
225225
args = append(args, "run")
226226
args = append(args, wsInfo.GetCheckoutLocation())
227227
cmd := remoteDevServerCmd(args)
228+
workspaceUrl, err := url.Parse(wsInfo.WorkspaceUrl)
229+
if err == nil {
230+
cmd.Env = append(cmd.Env, "JETBRAINS_GITPOD_WORKSPACE_HOST="+workspaceUrl.Hostname())
231+
}
228232
// Enable host status endpoint
229233
cmd.Env = append(cmd.Env, "CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod")
230234
if err := cmd.Run(); err != nil {

0 commit comments

Comments
 (0)