1

I am currently building a webapp that I will deploy to Heroku. My webapp references it's own data through an API.

For local development, I am referring to the api as such:

'http://localhost:3000/mywebapp/' + id + '/json'

For Heroku, I will have to do something like:

'http://mywebapp.herokuapp.com/' + id + '/json'

I have two git branches, say 'master' and 'dev'. 'Master' gets deployed to Heroku and receives final changes that are merged from 'dev'. My issue is having to constantly change my API code from my localhost to the heroku url.

Is there a way I can "lock in" the heroku URL in the master branch, so when I merge my local testing changes, it doesn't get overwritten?

Evan Emolo
  • 1,660
  • 4
  • 28
  • 44
  • Could this be related to your question? http://stackoverflow.com/q/1836742/1004046 – Pigueiras Apr 18 '13 at 21:16
  • It's related, however I am not looking to ignore a whole file. If anything I'm looking to ignore specific lines or strings in the file. – Evan Emolo Apr 18 '13 at 21:20
  • also related, but probably terrible: http://stackoverflow.com/questions/1288480 – kch Apr 19 '13 at 13:31

1 Answers1

2

A good way to handle this would be through environment variables. You can set the Heroku variable via the command line and then in code set the variables for your development environment.

here's one way to accomplish it - http://tammersaleh.com/posts/managing-heroku-environment-variables-for-local-development

Chris Piazza
  • 251
  • 2
  • 6
  • Could you add more information of what it is inside that link, please? It could be a useful for a user that found this question later and links might be broken in the future =) – Pigueiras Apr 18 '13 at 21:25
  • 2
    this is definitely the correct approach, also recommended by heroku official docs: https://devcenter.heroku.com/articles/config-vars – kch Apr 19 '13 at 13:32