I am not necessarily against global variables but my gut feeling was that there was something wrong/unnecessary with having one for the application URL. I had a look around the code and found that:
1. It is used in several different ways all of which are unnecessary (with the exception perhaps of email notifications)
2. It has led to some bad programming practices; it's used to break Rail's MVC pattern.
The worst case is where it is used in the models to write HTML and use named routes. This functionality belongs in the views and helpers.
For example in Photo.rb
def link_for_rss
"#{APP_URL}/#{self.user.login}/photos/#{self.to_param}" end
def description_for_rss "<a href='#{self.link_for_rss}' title='#{self.name}'><img src='#{self.public_filename(:large)}' alt='#{self.name}' /><br />#{self.description}</a>"
endOr in many of the models URLWriter is included so that named routes can be used as follows.
include ActionController::UrlWriter default_url_options[:host] = APP_URL.sub('http://', '')
To me, getting rid of the extra configuration step of setting APP_URL is not a necessity, but fixing the bigger problem of breaking the MVC pattern and thereby making the code easier to understand and maintain is worth doing.
I have been refactoring it in my copy of CE and when done will merge it into the source if people are interested.
Cheers,
--
BP