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

config.env should be overridden by runtime env variables #2209

Labels
bug confirmed bug released

Comments

@oosawy
Copy link

oosawy commented Jun 15, 2024

  • Versions: node@v20.12.0, linux@6.5.0-35-generic
  • nodemon -v: 3.1.3
  • Operating system/terminal environment (powershell, gitshell, etc): bash
  • Using Docker? What image: no
  • Command you ran: APP_ENV=local npx nodemon index.js

Expected behaviour

Runtime environment variables expected to override the env defined in config.

Actual behaviour

Envs defined in config.env are always be set.
Seeing dotenv etc. this is not the expected behavior.

Steps to reproduce

  1. make files
    nodemon.json
    {
      "env": {
        "APP_ENV": "development"
      }
    }
    index.js
    console.log(process.env.APP_ENV)
    
  2. run nodemon with env variable
    APP_ENV=local npx nodemon index.js
    
  3. see the output (ideally "local")
    development
    

If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

@remy remy added the bug confirmed bug label Jun 19, 2024
@remy remy closed this as completed in 6020968 Jun 20, 2024
Copy link

🎉 This issue has been resolved in version 3.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment