Nodemon: Set environment variables on start?

Created on 13 Nov 2015  Â·  6Comments  Â·  Source: remy/nodemon

I tried this in nodemon.json, seems like the command runs but doesn't set the variable:

  "events":{
    "start":"export PRIVATE_KEY=MyKey"
  }

What's the proper way to set an environment variable?

Most helpful comment

This worked, thanks!

{
  "env": {
    "PRIVATE_KEY": "MyKey",
    "DOCKER_MONGODB": "192.168.99.100:8000"
  }
}

All 6 comments

You can, I think, add an env property to your nodemon file, or via the CLI

On Fri, 13 Nov 2015 13:23 Sergei Basharov [email protected] wrote:

I tried this in nodemon.json, seems like the command runs but doesn't set
the variable:

"events":{
"start":"export PRIVATE_KEY=MyKey"
}

What's the proper way to set an environment variable?

—
Reply to this email directly or view it on GitHub
https://github.com/remy/nodemon/issues/727.

This worked, thanks!

{
  "env": {
    "PRIVATE_KEY": "MyKey",
    "DOCKER_MONGODB": "192.168.99.100:8000"
  }
}

If the issue is resolved, lets close it!

sorry, but what file does this go in?

{
  "env": {
    "PRIVATE_KEY": "MyKey",
    "DOCKER_MONGODB": "192.168.99.100:8000"
  }
}

@chovy

sorry, but what file does this go in?

{
  "env": {
    "PRIVATE_KEY": "MyKey",
    "DOCKER_MONGODB": "192.168.99.100:8000"
  }
}

It the nodemon.json file in the root directory.

@chovy

sorry, but what file does this go in?

{
  "env": {
    "PRIVATE_KEY": "MyKey",
    "DOCKER_MONGODB": "192.168.99.100:8000"
  }
}

It the nodemon.json file in the root directory.

And also in the package.json, as the value for the "nodemonConfig" key.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piton13 picture piton13  Â·  3Comments

ehmicky picture ehmicky  Â·  4Comments

Autre31415 picture Autre31415  Â·  4Comments

remy picture remy  Â·  5Comments

dimsmol picture dimsmol  Â·  4Comments