Right now, I've got a check to see if process.env._ ends with 'node.dev' to check if my service is running in node-dev, so it can automatically set some debug flags (like not running on HTTPS only).
It would be great if there was an easier way to detect this, like setting a well-defined, documented flag on process.env.
Good idea! Maybe something like process.node_dev instead of an environment variable?
set NODE_ENV to "development" (closes #62)
@fgnass Would it be possible to use a different environment variable than NODE_ENV to denote that one is running within node-dev, e.g. NODE_DEV=true? I ask because we and probably others want to know whether developer explicitly set NODE_ENV=development which is now not possible as node-dev sets it itself.
I'm hesitant because I think that coupling one's code to a specific process supervisor (like node-dev) would be a bad practice. But maybe I'm just missing a good use case. Can you elaborate in which situations you would want to perform such a check?
@fgnass Agreed, I now realize making it process supervisor specific would be bad. But then why even set NODE_ENV=development inside node-dev? Wouldn’t it be less opinionated to just have developers set environment variables externally, e.g. NODE_ENV=development node-dev app.js? I just checked and it works. The reason I am proposing this is because in our config system we want to distinguish whether the user set NODE_ENV or not, but if node-dev does it, it’s impossible to tell.
NODE_ENV=development node-dev app.js
Would setting NODE_ENV=development externally work for you @philion?
Feel free to expand on this if I missed anything, @aseemk.
+1 for not setting NODE_ENV at all
@fgnass Sweet! Now, let’s talk about logistics 😜
Technically, removing setting of NODE_ENV is a breaking change. Have you tried following semver so far which means we should bump it to 3.0.0, or shall we just release it as 2.8.0?
@philion Would it work for you to just set NODE_ENV externally instead of relying on node-dev for it? I’d appreciate your input 😃
Yep, versioning has been strictly semantic so far, so this would be 3.0.0.
@fgnass Thanks for confirming. I’ll remove the NODE_ENV setting code and publish as 3.0.0, so people like @philion should not be affected 👍