remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.21k stars 1.72k forks source link

environment variable specificity issue #2101

Closed cklanac closed 1 year ago

cklanac commented 1 year ago

Maybe I'm misunderstood, but the Config files documentation says that environment variables specified on the command line with override the values in the config files.

Setup

For easy demonstration purposes, create a node project with the following:

package.json

{
  "main": "index.js",
  "scripts": {
    "dev": "nodemon index.js",
    "alt": "SOME_VAR=override nodemon index.js"
  },
  "dependencies": {
    "nodemon": "^2.0.21"
  }
}

nodemon.json

{
    "env": {
        "SOME_VAR": "default"
    }
}

index.js

console.log('SOME_VAR: ', process.env.SOME_VAR)

Expected behavior

Actual behavior

More Information

Other variations produce the same result:

$ SOME_VAR=override nodemon index.js output SOME_VAR: default

$ cross-env SOME_VAR=override nodemon index.js output SOME_VAR: default

My environment details

github-actions[bot] commented 1 year ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

cklanac commented 1 year ago

@remy commenting to keep issue open

github-actions[bot] commented 1 year ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

github-actions[bot] commented 1 year ago

Automatically closing this issue due to lack of activity