Question

I'm a big fan of Heroku these days and as such I've been working to port some of my nodejs applications to their platform. Heroku utilizes an open-source tool known as foreman to simplify app start/stop etc. It blackboxes simple tasks such as loading an .env file before launching my nodejs server.

Now I need to debug and step-through some code locally and my question revolves around seeking the community's help on how to get the best setup for a debug configuration.

Question: I have installed nodeclipse to help me debug nodejs code locally. But when I run my debug configuration I don't know how to get the benefit of kicking up foreman to load my environment variables from the .env file. Can someone help me with this?

PS: I know that I could explicitly setup program or node arguments in the eclipse debug configuration window but that is exactly what I'm trying to avoid because there is no way that something like that will stay up-to-date. I am seeking one source of truth for my environment variables which is the .env file and I'd like to know if someone has good ideas on how to work that into a debug config launch from eclipse?

Was it helpful?

Solution

There are to questions here, actually

There first in the topic "How to invoke foreman via Eclipse when debugging", was already answered by @pulkitsinghal himself, i.e. create Run/Debug Configuration for Nodeclipse.

The second question is how to automate and take that information from .env (format that I don't know, just because every PaaS would make it's own format for such settings). That would let us be true to DRY principle.

The answer is DIY "Do it yourself"

The closet code to what you need is https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.debug/src/org/nodeclipse/debug/launch/LaunchConfigurationDelegate.java Maybe parsing .env into Configuration would be enough. Pull Request is welcomed.

You can also propose an idea at http://nodeclipse.uservoice.com/forums/216804-general , hopefully a lot of people needs the same.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top