Skip to content

Commit a14658e

Browse files
committed
[jb] allow to control xmx via [product]_XMX env var
1 parent dd95277 commit a14658e

File tree

1 file changed

+18
-0
lines changed
  • components/ide/jetbrains/image/status

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func main() {
8484
}
8585
}
8686

87+
err = configureXmx(alias)
88+
if err != nil {
89+
log.WithError(err).Error("failed to configure backend Xmx")
90+
}
8791
go run(wsInfo)
8892

8993
http.HandleFunc("/joinLink", func(w http.ResponseWriter, r *http.Request) {
@@ -254,6 +258,20 @@ func remoteDevServerCmd(args []string) *exec.Cmd {
254258
return cmd
255259
}
256260

261+
func configureXmx(alias string) error {
262+
xmx := os.Getenv(strings.ToUpper(alias) + "_XMX")
263+
if xmx == "" {
264+
return nil
265+
}
266+
launcherPath := "/ide-desktop/backend/plugins/remote-dev-server/bin/launcher.sh"
267+
content, err := ioutil.ReadFile(launcherPath)
268+
if err != nil {
269+
return err
270+
}
271+
newContent := strings.Replace(string(content), "2048m", xmx, 1)
272+
return ioutil.WriteFile(launcherPath, []byte(newContent), 0)
273+
}
274+
257275
/**
258276
{
259277
"buildNumber" : "221.4994.44",

0 commit comments

Comments
 (0)