Environment variable Support in "node" type app definitions

Product, Libraries & Version

Interop Desktop 9.9.4

Goal

Use an environment variable when running our node application and have node inherit it in process.env.

Steps tried

  1. Set allowEnvVars to true
  2. Added an env object with a key value pair of “ENV_FILE”: “.env.lp_dev”

From what I can see the app schema here doesn’t provide a environment variable configuration for type “node”, only thing related I can see is “nodeCLIOptions”. It seems however to be present on “window” and “exe” application types.

Does interop support this for node apps? To be clear this isn’t a web app, its a node CLI app that we auto start as part of our setup, there is no UI, hence not using it as a window.

Actual vs expected

Expected process.env to include our environment variable, which wasn’t the case.

2 Likes

I believe you are right - env is available in “exe”, but not in node. @georgi.davidkov can you confirm?

Yes this is correct, this is not supported for NodeJS apps

Currently for NodeJS apps you can use nodeCLIOptions - however these are cmd line arguments, not env variables.

1 Like

So the only alternative here for being able to set environment variables is to use an exe type application and call the node command directly? We’ve got plenty of cases at the moment where we need to run a node app that needs to use environment variables and it sounds like the node app type is very limited- what options do we have instead of this?

Hi @adnanahmad

Sorry for the delay. Can you provide a bit more detail about your use case and workflow here?

allowEnvVars is for web apps and enables them to access the main process env variables using glue42gd.env object. And node app started as apps should inherit these vars by default.

Hi @adnanahmad,

I encountered the same issue. Initially, I considered configuring the required properties via app-config, but later realized that using a gilding.json file with the necessary environment variables is a better approach.

For local development, setting the environment variables directly is sufficient. However, for production environments, we recommend using remoteConfig for improved security.

io.Connect Desktop Documentation - Configuration > System.

Note: In addition to the documentation, it can be useful to pass the configuration file explicitly to the io-connect-desktop executable:

io-connect-desktop.exe --gildingConfigFile=gilding-ENV-Region.json

This works both when launching via a shortcut and from the command line.

Best regards,
Iskren

1 Like

Important (Upgrade Limitation):
Please note that when upgrading to io.Connect Desktop 10.0, support for loading configuration via gilding.json is not available. This functionality is planned and scheduled for implementation in a future release of io.Connect Desktop.
As a result, customers who rely on gilding.json must remain on an io.Connect Desktop 9.x version and defer upgrading to v10.0 until this support is reintroduced.

1 Like