Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use sinatra's configuration settings instead of a constant.

  • Loading branch information...
commit 25747697911b829c6a61d5636d97a737afc91135 1 parent c49482d
@benburkert benburkert authored
Showing with 5 additions and 4 deletions.
  1. +0 −2  github-services.rb
  2. +5 −2 lib/app.rb
View
2  github-services.rb
@@ -5,8 +5,6 @@
:port => ARGV.first || 8080,
:logging => true
-HOSTNAME = `hostname`.chomp
-
begin
require 'mongrel'
Service::App.set :server, 'mongrel'
View
7 lib/app.rb
@@ -1,5 +1,8 @@
# The Sinatra App that handles incoming events.
class Service::App < Sinatra::Base
+
+ set :hostname, lambda { %x{hostname} }
+
# Hooks the given Service to a Sinatra route.
#
# svc - Service instance.
@@ -58,7 +61,7 @@ def report_exception(exception)
'app' => 'github-services',
'type' => 'exception',
'class' => exception.class.to_s,
- 'server' => HOSTNAME,
+ 'server' => settings.hostname,
'message' => exception.message[0..254],
'backtrace' => backtrace.join("\n"),
'rollup' => Digest::MD5.hexdigest(exception.class.to_s + backtrace[0])
@@ -75,7 +78,7 @@ def report_exception(exception)
data['class'] = 'Service::Error'
end
- if HOSTNAME =~ /^sh1\.(rs|stg)\.github\.com$/
+ if settings.hostname =~ /^sh1\.(rs|stg)\.github\.com$/
# run only in github's production environment
Net::HTTP.new('haystack', 80).
post('/async', "json=#{Rack::Utils.escape(data.to_json)}")
Please sign in to comment.
Something went wrong with that request. Please try again.