Reputation: 385
I have a node.js app which i'm building/hosting on Heroku. I would like to use the environment variables set on Heroku when building my application. for example in package.json
"scripts": {
"postinstall": "build --option="MY_HEROKU_ENVIRONMENT_VARIABLE"
}
is it possible to read those variables when the script is run?
Thanks in advance /Eric
Upvotes: 3
Views: 1303
Reputation: 33824
No, this is not possible. What you can do instead is define a Node script to run, and have that script itself use environment variables.
For instance, what if your postinstall
target was just node postinstall.js
, and then inside of your postinstall.js
script you read the process.env.MY_HEROKU_ENVIRONMENT_VARIABLE
value?
Upvotes: 3