Determine the node runtime mode.

The mode is calculated from NODE_ENV. If NODE_ENV is not set or set to something other than expected values, the defaultMode is returned.