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.