I need to configure one of the modules in my application and give it a specific URL based on the host name. Something like http://localhost locally and http://myapp.herokuapp.com . I know that I can simply encode the value depending on NODE_ENV or even store it as an environment value and use process.env.CUSTOMVAR_HOSTNAME . But for some reason this seems wrong, since myapp already configured in the Heroku admin panel. And I can not use request.headers.host , since the configuration of the module occurs at the beginning of the application, before any request can be processed.
Is there any way to get Heroku application name from code? Or from an environment variable? I want my code to stay the same, whether I was executing the code locally or on Heroku (or anywhere else really).
DjebbZ
source share