Skip to content

Commit 4a3b3fa

Browse files
snusnudefunkt
authored andcommitted
Don't depend on RAILS_ENV in hoptoad failure backend
Checks if RAILS_ENV is defined? and if so, uses that. Otherwise, tries to use ENV['RACK_ENV'] and if that isn't available, falls back to 'development'. Extracts this into it's own method so that subclasses can overwrite the method to use, say ENV['MERB_ENV']
1 parent fc64151 commit 4a3b3fa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/resque/failure/hoptoad.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def xml
9696
end
9797
end
9898
x.tag!("server-environment") do
99-
x.tag!("environment-name",RAILS_ENV)
99+
x.tag!("environment-name",server_environment)
100100
end
101101

102102
end
@@ -116,6 +116,11 @@ def use_ssl?
116116
def api_key
117117
self.class.api_key
118118
end
119+
120+
def server_environment
121+
defined?(RAILS_ENV) ? RAILS_ENV : (ENV['RACK_ENV'] || 'development')
122+
end
123+
119124
end
120125
end
121126
end

0 commit comments

Comments
 (0)