title: How can I check if my pm2 app NODE_ENV is getting set?
body: <p>So I just deployed a site with node and pm2 for the first time and I'm going back and doing some optimization and reading best practices, etc.</p>
  
  <p>I read that you can get a lot of benefit by setting <code>NODE_ENV=production</code>.</p>
  
  <p>I found this in the pm2 docs:</p>
  
  <pre><code>[process.json]
  "env_production" : {
    "NODE_ENV": "production"
  }
  
  ...
  
  $ pm2 start process.json --env production
  </code></pre>
  
  <p>So, I did it but I have no idea if it is working. While trying to figure out how to check it I learned to try:</p>
  
  <pre><code>$ node
  &gt; process.env.NODE_ENV
  &gt; undefined
  </code></pre>
  
  <p>So, that's not a good sign.. but, with my limited understanding of how the low level stuff works, I can guess that maybe pm2 launches each app as a separate node process? So maybe I'm not in the right process when I try to check it.</p>
  
  <p>Also, I don't know if I have to make a new ~/.pm2/dump.pm2 file because maybe whenever that is maybe overriding the options I set? (because I used <code>pm2 startup</code>).</p>
  
  <p>How do I check if my pm2 app's NODE_ENV is set?</p>