'How to set env variable in Heroku with Node.js?

How to set env variable Heroku with Node.js? I opened Heroku account but unable to find out the possible solution to set my env variables up.



Solution 1:[1]

Go to your deployed app settings. Then, in "config vars" section click on "Reveal Config Vars" button and you can enter env variables there, which will be also available in your application

Like this: enter image description here

Solution 2:[2]

There are different ways to set it up. You can either use the Heroku CLI to update the same. In your command line, after installing the Heroku cli,

Run heroku config:set ENV_VARIABLE=VALUE

Also If you want to update the env variables on Heroku Dashboard,
Go to your app settings. There is a button called "Reveal Config Vars", You can add and update the same there without any cli usage.

All of these details are available here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Vishnu Raj