3

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

1 Answer 1

3

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.