# How to set env variable

**URL:** <https://discourse.nodered.org/t/how-to-set-env-variable/18612>\
**Category:** General\
**Created:** [29 November 2019 14:33 UTC](https://discourse.nodered.org/t/how-to-set-env-variable/18612 "2019-11-29T14:33:28Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [29 November 2019 14:44 UTC](https://discourse.nodered.org/t/how-to-set-env-variable/18612/5 "2019-11-29T14:44:18Z")

</div>

One way of setting environment variables is in your `settings.js` file.

The following will set the env var `MY_ENV_VAR`:

```auto
process.env.MY_ENV_VAR = "Hello World";

```

You can add lines like that to the top of your settings file.

The other option is to set them completely outside of Node-RED in shell you are running Node-RED in. How you do that will depend on your OS and how you are running Node-RED.

---

_[View the full topic](https://discourse.nodered.org/t/how-to-set-env-variable/18612)._
