Domanda

Anyone know how to set environment variables for running and debugging Node.js applications in Eclipse + Nodeclipse aka Enide Studio? For example, in a .js file, an environment variable can be referenced as process.env.PORT, for the environment variable PORT. How can I specify this variable within Enide?

È stato utile?

Soluzione

I found the solution to my question. First, go to the menu item File > Properties. Then select Run/Debug Settings from the options on the left of the dialog. Then select the .js file for which you want to set an environment variable during debugging/running programs in Enide Studio / Eclipse + Nodeclipse. Then select the [Edit] button. On the dialog that appears, select the [Environment] tab. Then select the [New] button and enter in your desired variable name and value. Repeat for multiple environment variables. Click [Apply], then try running your program. Your environment values should be available as process.env.YOUR_VARIABLE_NAME in your Node.js source code.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top