Skip to content

Commit e80f26e

Browse files
committed
[jb] allow to control xmx via [product]_XMX env var
1 parent 03675fc commit e80f26e

File tree

1 file changed

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

1 file changed

+19
-0
lines changed

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

Lines changed: 19 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) {
@@ -258,6 +262,21 @@ func remoteDevServerCmd(args []string) *exec.Cmd {
258262
return cmd
259263
}
260264

265+
func configureXmx(alias string) error {
266+
xmx := os.Getenv(strings.ToUpper(alias) + "_XMX")
267+
if xmx == "" {
268+
return nil
269+
}
270+
launcherPath := "/ide-desktop/backend/plugins/remote-dev-server/bin/launcher.sh"
271+
content, err := ioutil.ReadFile(launcherPath)
272+
if err != nil {
273+
return err
274+
}
275+
// by default remote dev already set -Xmx2048m, see /ide-desktop/backend/plugins/remote-dev-server/bin/launcher.sh
276+
newContent := strings.Replace(string(content), "-Xmx2048m", "-Xmx"+xmx, 1)
277+
return ioutil.WriteFile(launcherPath, []byte(newContent), 0)
278+
}
279+
261280
/**
262281
{
263282
"buildNumber" : "221.4994.44",

0 commit comments

Comments
 (0)