Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option to pass environment variables to the workers #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leops
Copy link

@leops leops commented May 17, 2016

This PR adds a new env option, a simple key-value object to be passed to cluster.fork() in order to inject additional environment variables into the workers.

@mdlawson
Copy link
Owner

I'm open to adding this, but can I ask what the use case for this is? Any environment variables set on the process should be passed through to the forked version, and seeing as piping is intended to be pretty transparent I'm not sure what the benefit is.

@leops
Copy link
Author

leops commented May 26, 2016

In our project, we use this option to pass specific configuration options to the server instance in a development environment.

@mdlawson
Copy link
Owner

mdlawson commented Jun 4, 2016

I've added this to 1.0.0-rc.2, which is an ES6 rewrite of piping. Could you check everything is working for you there?

@leops
Copy link
Author

leops commented Jun 6, 2016

It's working but I had to add to set the throw option to false, otherwise it simply crashes. Did I miss something there ?

@mdlawson
Copy link
Owner

mdlawson commented Jun 7, 2016

The idea behind the throw option is to "crash" the initial process to prevent application code from executing on it, but an uncaught exception handler should mean the process doesn't actually exit. Is it possible that piping is required within some environment which contains a try/catch block which would mess with that concept?

An example showing the crashing would be great, it worked fine in my testing, though is regrettably not amiable to testing in general. I may disable it by default if it usually causes issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants