redhat-developer / vscode-server-connector

📦 Connects Visual Studio Code to your server adapters and run, deploy apps !!
Eclipse Public License 2.0
57 stars 26 forks source link

Unable to specify environment variables with server #511

Closed dashorst closed 3 years ago

dashorst commented 3 years ago

With JBoss Tools for Eclipse you can specify environment variables, but this doesn't seem possible with the server connector currently available in VSCode. I've looked at the available settings for e.g. wildfly, but that doesn't show any possibility to add environment vars. Did I miss something, or is this impossible now (and in the future?)

robstryker commented 3 years ago

The wildfly / eap adapters use the rsp-server repository. The generic servers use the rsp-server-community repository. While the generic servers do simplify a lot of using the underlying rsp-server api, they also necessarily block access to some of the deeper customizations, at least initially. So, it appears rsp-server-community does not expose any access to environment variables.

When looking inside the rsp-server repository, we make use of this class as a superclass: https://github.com/redhat-developer/rsp-server/blob/b0bdb2b4ce9a7b43a0b6dec25f3ca7710baef253/framework/bundles/org.jboss.tools.rsp.server.spi/src/main/java/org/jboss/tools/rsp/server/spi/launchers/AbstractJavaLauncher.java#L201

This class and it's subclasses are in charge of launching the process for the underlying server. You can see here that there's a protected method for getting a custom environment. Unfortunately, it seems none of the implementation classes override this or provide any implementation that would actually be able to change this environment variable from data stored in teh server-adapter object / json file.

So yeah, you're right. As of right now, nobody is changing environment or exposing access to do so.

robstryker commented 3 years ago

Opened https://github.com/redhat-developer/rsp-server/pull/656