I have a nose.js pipeline on Heroku with review apps spwaned automatically for pull requests.
How can I get the url of heroku apps (https://xyz.herokuapp.com) at runtime using node.js or do I have to hardcode the value as an environment variable.
You should be able to get the xyz part of the URL from the HEROKU_APP_NAME environment variable:
process.env.HEROKU_APP_NAME
Heroku sets this environment variable automatically for review apps if you specify it in your app.json with
"env":{
"HEROKU_APP_NAME": {
"required": true
},
"HEROKU_PARENT_APP_NAME": {
"required": true
}
}
You can also get it for non-review apps I think see, https://devcenter.heroku.com/articles/dyno-metadata