arches/marco-polo — pull request #2 by kyanny (2014-03-21 09:04:57+00:00)
Title: Make current_app customizable

Hi, thank you for providing such a nice gem :smile:

I want to customize current_app name by ENV.

In my company, we have many apps on Heroku. They are running "production" environment but have different heroku app name (e.g. mycompany-myapp-servicename1 and mycompany-myapp-servicename2).

So I added a few lines. Please look a diff.

* `ENV["MARCO_POLO_APP_NAME"]` for non-Heroku stack (e.g. EngineYard Cloud, AWS Elastic Beanstalk, etc.)
* `ENV["HEROKU_APP_NAME"]` for Heroku stack

The order of getting current_app name is:

1. Try to get `ENV["MARCO_POLO_APP_NAME"]`. If it exists, use it.
2. Try to get `ENV["HEROKU_APP_NAME"]`. If it exists, use it.
3. None of them are defined, fallback to get current_app in normal way.

I've tested it on my personal Heroku app and it works well. I checked both `irb` and `pry`.

How do you think?