Skip to content

Commit 8e99569

Browse files
committed
Hoptoad: Make server_environment a config setting, too
1 parent fc26509 commit 8e99569

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/resque/failure/hoptoad.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ module Failure
1515
# # optional proxy support
1616
# config.proxy_host = 'x.y.z.t'
1717
# config.proxy_port = 8080
18+
#
19+
# # server env support, defaults to RAILS_ENV or RACK_ENV
20+
# config.server_environment = "test"
1821
# end
1922
class Hoptoad < Base
2023
# From the hoptoad plugin
2124
INPUT_FORMAT = /^([^:]+):(\d+)(?::in `([^']+)')?$/
2225

2326
class << self
2427
attr_accessor :secure, :api_key, :proxy_host, :proxy_port
28+
attr_accessor :server_environment
2529
end
2630

2731
def self.count
@@ -105,7 +109,7 @@ def xml
105109
def fill_in_backtrace_lines(x)
106110
exception.backtrace.each do |unparsed_line|
107111
_, file, number, method = unparsed_line.match(INPUT_FORMAT).to_a
108-
x.line :file=>file,:number=>number
112+
x.line :file => file,:number => number
109113
end
110114
end
111115

@@ -118,9 +122,9 @@ def api_key
118122
end
119123

120124
def server_environment
125+
return self.class.server_environment if self.class.server_environment
121126
defined?(RAILS_ENV) ? RAILS_ENV : (ENV['RACK_ENV'] || 'development')
122127
end
123-
124128
end
125129
end
126130
end

0 commit comments

Comments
 (0)